; Common state file for M.U.G.E.N beta 2002.04.14
;
; System variables usage
; ----------------------
; Var name    Type   Purpose
; --------    ----   -------
; sysvar(0)   Temp   Set by state 5081 (HITL_SLIDE) to 1 to prevent
;                    showing ground hit frame in state 5110 (HIT_LIEDOWN).
;                    Used by guarding states.
; sysvar(1)   Temp   Used by state 40 (Jump Start) amd 45 (Air Jump Start)
;                    to keep track of which way to jump.
;                    Used by state 5100 and 5110 to remember downward
;                    velocity of player just before hitting the ground.
;                    Used in state 5080 for storing the anim # to display.

; The following states have special handling within MUGEN, and should be
; overridden with caution:
; Jump Start (40): airjumping bookkeeping at time = 0
; All guard states (120-155): guard handling throughout state
; Hit_trip, shaking (5070): defence increases at time = 0
; Hit_bounce (5100): defence increases at time = 0, player becomes
;                    invincible if within 10 ticks of getting up
; Hit_liedown (5110): player changes to get-up state (5120) when ready
; Hit_getup (5120): player's defence is restored to normal at time = 0
; Hitfall_recover (5200): player's defence is restored at time = 0
; Hitfall_airrecover (5210): player's defence is restored at time = 0

;---------------------------------------------------------------------------
; Stand
[Statedef 0]
type = S
physics = S
sprpriority = 0

[State 0, 1]
type = ChangeAnim
trigger1 = Anim != 0 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
value = 0

[State 0, 2]
type = VelSet
trigger1 = Time = 0
y = 0

[State 0, 3] ;Stop moving if low velocity or 4 ticks pass
type = VelSet
trigger1 = abs(vel x) < 2
trigger2 = Time = 4
x = 0

[State 0, 6] ;Are you dead?
type = ChangeState
trigger1 = !alive
value = 5050

;---------------------------------------------------------------------------
; Stand to Crouch
[Statedef 10]
type    = C
physics = C
anim = 10

[State 10, 1]
type = VelMul
trigger1 = Time = 0
x = .75

[State 10, 2]
type = ChangeState
trigger1 = AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; Crouching
[Statedef 11]
type    = C
physics = C
anim = 11
sprpriority = 0

[State 11, 1] ;Change from turning animation
type = ChangeAnim
trigger1 = Anim = 6 && AnimTime = 0
value = 11

;---------------------------------------------------------------------------
; Crouch to Stand
[Statedef 12]
type    = S
physics = S
anim = 12

[State 12, 1]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; Walk
[Statedef 20]
type    = S
physics = S
sprpriority = 0

[State 20, 1]
type = VelSet
trigger1 = command = "holdfwd"
x = const(velocity.walk.fwd.x)*const(size.xscale)

[State 20, 2]
type = VelSet
trigger1 = command = "holdback"
x = const(velocity.walk.back.x)*const(size.xscale)

[State 20, 3]
type = ChangeAnim
triggerall = vel x > 0
trigger1 = Anim != 20 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 20

[State 20, 4]
type = ChangeAnim
triggerall = vel x < 0
trigger1 = Anim != 21 && Anim != 5
trigger2 = Anim = 5 && AnimTime = 0
value = 21
;---------------------------------------------------------------------------
; Jump Start
[Statedef 40]
type    = S
physics = S
anim = 40
ctrl = 0
sprpriority = 1
facep2 = 1

[State 40, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 40, 2]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 40, 3]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 40, 4]
type = VelSet
trigger1 = AnimTime = 0
x = ifelse(sysvar(1)=0, const(velocity.jump.neu.x), ifelse(sysvar(1)=1, const(velocity.jump.fwd.x), const(velocity.jump.back.x)))
y = const(velocity.jump.y)

[State 40, 5]
type = VelSet
trigger1 = AnimTime = 0
trigger1 = prevstateno = 100 ;RUN_FWD
trigger1 = sysvar(1) = 1
x = const(velocity.runjump.fwd.x)

[State 40, 6]
type = NotHitBy
trigger1 = 1
value = ,NT,ST
time = 1

[State 40, 7]
type = ChangeState
trigger1 = AnimTime = 0
value = 50
ctrl = 1
;---------------------------------------------------------------------------
; AirJump Start
[Statedef 45]
type    = A
physics = N
ctrl = 0
velset = 0,0

[State 45, 1]
type = ChangeAnim
trigger1 = SelfAnimExist(44)
value = 44

[State 45, 2]
type = ChangeAnim
trigger1 = !SelfAnimExist(44)
value = 41

[State 45, 3]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 45, 4]
type = VarSet
trigger1 = command = "holdfwd"
sysvar(1) = 1

[State 45, 5]
type = VarSet
trigger1 = command = "holdback"
sysvar(1) = -1

[State 45, 6]
type = VelSet
trigger1 = Time = 2
x = ifelse(sysvar(1)=0, const(velocity.airjump.neu.x), ifelse(sysvar(1)=1, const(velocity.airjump.fwd.x), const(velocity.airjump.back.x)))
y = const(velocity.airjump.y)

[State 45, 7]
type = ChangeState
trigger1 = Time = 2
value = 50
ctrl = 1

;---------------------------------------------------------------------------
; Jump Up
[Statedef 50]
type    = A
physics = A

[State 50, 1]
type = VarSet
trigger1 = Time = 0
sysvar(1) = 0

[State 50, 2]
type = ChangeAnim
trigger1 = Time = 0
value = ifelse((vel x)=0, 41, ifelse((vel x)>0, 42, 43))

[State 50, 3]
type = ChangeAnim
trigger1 = Vel y > -2
trigger1 = SelfAnimExist(anim + 3)
persistent = 0
value = Anim + 3

[State 50, 4]
type = VelSet
triggerall = Vel X = 0 && Time > 2
trigger1 = !var(59) && Command = "FF"
trigger2 = var(59)
trigger2 = ((enemy,fvar(30) < 32.4) && (enemy,fvar(30) > 0)) || ((enemy,fvar(32) < 32.4) && (enemy,fvar(32) > 0)) || ((enemy,fvar(34) < 32.4) && (enemy,fvar(34) > 0))
trigger2 = ((enemy,fvar(31) > -42.6) && (enemy,fvar(31) < 0)) || ((enemy,fvar(33) > -42.6) && (enemy,fvar(33) < 0)) || ((enemy,fvar(35) > -42.6) && (enemy,fvar(35) < 0))
trigger3 = var(59) > 0
Trigger3 = random<var(50)*0.4
x = Const(velocity.runjump.fwd.x)*const(size.xscale)

[State 50, 5]
type = VelSet
triggerall = Vel X = 0 &&  Time > 2 && !var(59)
trigger1 = !var(59) && Command = "BB"
trigger2 = var(59) > 0
Trigger2 = P2BodyDist X < 20 && P2BodyDist X > 0
Trigger2 = random<var(50)*0.1
x = Const(velocity.runjump.back.x)*const(size.xscale)

;---------------------------------------------------------------------------
; Jump Down (empty state for compatibility)
[Statedef 51]
type    = A
physics = A

[State 51, 1]
type = Null
trigger1 = 1

;---------------------------------------------------------------------------
; Jump Land
[Statedef 52]
type    = S
physics = S
ctrl = 1
anim = 47

[State 52, 2]
type = VelSet
trigger1 = Time = 0
y = 0

[State 52, 3]
type = PosSet
trigger1 = Time = 0
y = 0

[State 52, 4]
type = CtrlSet
trigger1 = Time = 3
value = 11

[State 52, 5]
type = PlaySnd
trigger1 = !Time
value = S40,1

[State 52, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HOP_FWD
[Statedef 100]
type    = S
physics = N
anim = 100
ctrl = 0
sprpriority = 1

[State 100, 1]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.fwd.x)*const(size.xscale)
y = const(velocity.run.fwd.y)*const(size.yscale)

[State 100, 2] ;Prevent run from canceling into walk
type = AssertSpecial
trigger1 = 1
flag = NoWalk

[State 100, 3] ;Prevent from turning
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 100, 4]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 100, 5]
type = PlaySnd
trigger1 = !Time
value = S40,0

[State 100, 6]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= 0					 
value = 101
;---------------------------------------------------------------------------
; HOP_FWD2 (land)
[Statedef 101]
type    = S
physics = S
ctrl = 1
anim = 101

[State 101, 1]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 101, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 101, 3]
type = CtrlSet
trigger1 = Time = 5
value = 1

[State 101, 4]
type = PlaySnd
trigger1 = !Time
value = S40,1

[State 106, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; HOP_BACK
[Statedef 105]
type    = A
physics = N
ctrl = 0
anim = 105
sprpriority = 1

[State 105, 1]
type = VelSet
trigger1 = Time = 0
x = const(velocity.run.back.x)*const(size.xscale)
y = const(velocity.run.back.y)*const(size.yscale)

[State 105, 2]
type = PlaySnd
trigger1 = !Time
value = S40,0

[State 105, 3]
type = VelAdd
trigger1 = 1
y = .44*const(size.yscale)

[State 105, 4]
type = NotHitBy
trigger1 = !Time
value = SCA,AA,AP,AT
time = 5

[State 100, 5]
type = ChangeState
trigger1 = Vel Y > 0 && Pos Y >= 0					 
value = 106

;---------------------------------------------------------------------------
; HOP_BACK2 (land)
[Statedef 106]
type    = S
physics = S
ctrl = 0
anim = 106

[State 106, 1]
type = VelSet
trigger1 = Time = 0
x = 0
y = 0

[State 106, 2]
type = PosSet
trigger1 = Time = 0
y = 0

[State 106, 3]
type = PlaySnd
trigger1 = !Time
value = S40,1

[State 106, 4]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; RUN_UP
[Statedef 110]
type    = S
physics = N

[State 110, 0]
type = CtrlSet
trigger1 = Time = 0
value = 0

[State 110, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 110

[State 110, 2]
type = HitBy
trigger1 = Time = 0
value = SCA, NT, ST, HT
time = 30

[State 110, 3]
type = VelSet
trigger1 = Time = 0
x = 0
z = -7

[State 110, 4]
type = VelMul
trigger1 = 1
z = 0.8

[State 110, 5]
type = VelSet
trigger1 = AnimTime = -8
z = 0

[State 110, 7]
type = CtrlSet
trigger1 = AnimTime = 0
value = 1

[State 110, 8]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
; RUN_DOWN
[Statedef 115]
type    = S
physics = N

[State 115, 0]
type = CtrlSet
trigger1 = Time = 0
value = 0

[State 115, 1]
type = ChangeAnim
trigger1 = Time = 0
value = 110

[State 115, 2]
type = HitBy
trigger1 = Time = 0
value = SCA, NT, ST, HT
time = 30

[State 115, 3]
type = VelSet
trigger1 = Time = 0
x = 0
z = 7

[State 115, 4]
type = VelMul
trigger1 = 1
z = 0.8

[State 115, 5]
type = VelSet
trigger1 = AnimTime = -8
z = 0

[State 115, 7]
type = CtrlSet
trigger1 = AnimTime = 0
value = 1

[State 115, 8]
type = ChangeState
trigger1 = AnimTime = 0
value = 0

;---------------------------------------------------------------------------
;Guard Start
[StateDef 120]
type = U
physics = U
anim = 120 + (StateType = C) + (StateType = A) * 2

[State 120, StateTypeSet: Standing]
type = StateTypeSet
trigger1 = !Time && StateType = S
physics = S

[State 120, StateTypeSet: Crouching]
type = StateTypeSet
trigger1 = !Time && StateType = C
physics = C

[State 120, StateTypeSet: Jumping]
type = StateTypeSet
trigger1 = !Time && StateType = A
physics = A

[State 120, VelSet]
type = VelSet
trigger1 = !Time && StateType != A
x = 0
y = 0

[State 120, Stand to Crouching]
type = StateTypeSet
trigger1 = !AILevel && StateType = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 120, Crouching to Stand]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AILevel && StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

[State 120, AI Fix]
type = CtrlSet
trigger1 = AILevel && NumEnemy
value = (EnemyNear, Time >= 120 || Time >= 180)

[State 120, Change to Guard State]
type = ChangeState
trigger1 = !AnimTime || AILevel
value = 130 + (StateType = C) + (StateType = A) * 2

[State 120, Stop Guarding]
type = ChangeState
trigger1 = (!AILevel && ((ifElse(P2dist x < 0, Facing = -1, Facing = 1) && (NumExplod(90000004) + NumExplod(90000001) + NumExplod(90000007) < 1)) || (ifElse(P2dist x < 0, Facing = 1, Facing = -1) && (NumExplod(90000006) + NumExplod(90000003) + NumExplod(90000009) < 1))))
trigger2 = !InGuardDist
trigger3 = AILevel && NumEnemy
trigger3 = EnemyNear, HitDefAttr = SCA, AT
value = 140

;---------------------------------------------------------------------------
;Standing Guard
[StateDef 130]
type = S
physics = S

[State 130, ChangeAnim]
type = ChangeAnim
trigger1 = Anim != 130
value = 130

[State 130, AI Fix]
type = CtrlSet
trigger1 = AILevel && NumEnemy
value = (EnemyNear, Time >= 120 || Time >= 180)

[State 130, Standing to Crouch]
type = ChangeState
trigger1 = !AILevel && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger2 = (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
value = 131

[State 130, Stop Guarding]
type = ChangeState
trigger1 = (!AILevel && ((ifElse(P2dist x < 0, Facing = -1, Facing = 1) && (NumExplod(90000004) + NumExplod(90000001) + NumExplod(90000007) < 1)) || (ifElse(P2dist x < 0, Facing = 1, Facing = -1) && (NumExplod(90000006) + NumExplod(90000003) + NumExplod(90000009) < 1))))
trigger2 = !InGuardDist
trigger3 = AILevel && NumEnemy
trigger3 = EnemyNear, HitDefAttr = SCA, AT
value = 140

;[State 130, Landing Sound]
;type = PlaySnd
;trigger1 = !Time
;trigger1 = PrevStateNo = 132 || (PrevStateNo = [154,155])
;value = 52,0

;[State 130, Landing Dust Expod]
;type = Explod
;trigger1 = !Time
;trigger1 = PrevStateNo = 132 || (PrevStateNo = [154,155])
;anim = 8102
;sprpriority = -3
;posType = P1
;scale = 0.5,0.5
;pauseMoveTime = -1
;superMoveTime = -1
;ownPal = 1

;---------------------------------------------------------------------------
;Crouch Guarding
[StateDef 131]
type = C
physics = C

[State 131, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 131
value = 131

[State 131, Crouching to Standing]
type = ChangeState
trigger1 = !AILevel && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger2 = (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
value = 130

[State 131, AI Fix]
type = CtrlSet
trigger1 = AILevel && NumEnemy
value = (EnemyNear, Time >= 120 || Time >= 180)

[State 131, Stop Guarding]
type = ChangeState
trigger1 = (!AILevel && ((ifElse(P2dist x < 0, Facing = -1, Facing = 1) && (NumExplod(90000004) + NumExplod(90000001) + NumExplod(90000007) < 1)) || (ifElse(P2dist x < 0, Facing = 1, Facing = -1) && (NumExplod(90000006) + NumExplod(90000003) + NumExplod(90000009) < 1))))
trigger2 = !InGuardDist
trigger3 = AILevel && NumEnemy
trigger3 = EnemyNear, HitDefAttr = SCA, AT
value = 140

;---------------------------------------------------------------------------
;Air Guard
[StateDef 132]
type = A
physics = N

[State 132, ChangeAnim]
type = ChangeAnim
trigger1 = anim != 132
value = 132

[State 132, VelAdd]
type = VelAdd
trigger1 = 1
y = const(movement.yAccel)

[State 132, VarSet]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0 && vel y > 0)

[State 132, VelSet]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 132, PosSet]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 132, AI Fix]
type = CtrlSet
trigger1 = AILevel && NumEnemy
value = (EnemyNear, Time >= 120 || Time >= 180)

[State 132, Jumping to Standing]
type = ChangeState
trigger1 = sysvar(0) && InGuardDist
trigger1 = (!AILevel && ((ifElse(P2dist x < 0, Facing = -1, Facing = 1) && (NumExplod(90000004) + NumExplod(90000001) + NumExplod(90000007) > 0)) || (ifElse(P2dist x < 0, Facing = 1, Facing = -1) && (NumExplod(90000006) + NumExplod(90000003) + NumExplod(90000009) > 0)))) || AILevel
value = 130

[State 132, Change to Falling]
type = ChangeState
trigger1 = sysvar(0)
value = 52

[State 132, Stop Guarding]
type = ChangeState
trigger1 = (!AILevel && ((ifElse(P2dist x < 0, Facing = -1, Facing = 1) && (NumExplod(90000004) + NumExplod(90000001) + NumExplod(90000007) < 1)) || (ifElse(P2dist x < 0, Facing = 1, Facing = -1) && (NumExplod(90000006) + NumExplod(90000003) + NumExplod(90000009) < 1))))
trigger2 = !InGuardDist
trigger3 = AILevel && NumEnemy
trigger3 = EnemyNear, HitDefAttr = SCA, AT
value = 140

;---------------------------------------------------------------------------
;Guard End
[StateDef 140]
type = U
physics = U
ctrl = 1

[State 140, ChangeAnim]
type = ChangeAnim
trigger1 = !Time
value = 140 + (StateType = C) + (StateType = A) * 2

[State 140, StateTypeSet: Standing]
type = StateTypeSet
trigger1 = !Time && StateType = S
physics = S

[State 140, StateTypeSet: Crouching]
type = StateTypeSet
trigger1 = !Time && StateType = C
physics = C

[State 140, StateTypeSet: Jumping]
type = StateTypeSet
trigger1 = !Time && StateType = A
physics = A

[State 140, Standing to Crouching]
type = StateTypeSet
trigger1 = !AILevel && StateType = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger2 = StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 140, Crouching to Standing]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger2 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

[State 140, End]
type = ChangeState
trigger1 = !AnimTime
value = (StateType = C) * 11 + (StateType = A) * 51

;---------------------------------------------------------------------------
;Hit while Guarding (Standing)
[StateDef 150]
type = S
movetype = H
physics = N
velSet = 0,0

[State 150, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 150

[State 150, End]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2 * ((!AILevel && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))) || (AILevel && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)))

[State 150, Standing to Crouching]
type = StateTypeSet
trigger1 = !AILevel && StateType = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
stateType = C
physics = C

[State 150, Crouching to Standing]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AIlevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger2 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

;---------------------------------------------------------------------------
;Knocked Back while Guarding (Standing)
[StateDef 151]
type = S
moveType = H
physics = S
anim = 150

[State 151, HitVelSet]
type = HitVelSet
trigger1 = !Time
x = 1

[State 151, VelSet]
type = VelSet
trigger1 = Time = GetHitVar(SlideTime)
trigger2 = HitOver
x = 0

[State 151, CtrlSet]
type = CtrlSet
trigger1 = time = GetHitVar(CtrlTime)
value = 1

[State 151, Standing to Crouching]
type = StateTypeSet
trigger1 = !AILevel && StateType = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger2 = StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 151, Crouching to Standing]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger2 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

[State 151, End]
type = ChangeState
trigger1 = HitOver
value = 130
ctrl = 1

;---------------------------------------------------------------------------
;Hit while Guarding (Crouching)
[StateDef 152]
type = C
moveType = H
physics = N
velSet = 0,0

[State 152, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 151

[State 152, End]
type = ChangeState
trigger1 = HitShakeOver
value = 151 + 2 * ((!AILevel && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))) || (AILevel && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)))

[State 152, Standing to Crouching]
type = StateTypeSet
trigger1 = !AILevel && statetype = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger2 = StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 152, Crouching to Standing]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger2 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

;---------------------------------------------------------------------------
;Knocked Back while Guarding (Crouching)
[StateDef 153]
type = C
moveType = H
physics = C
anim = 151

[State 153, HitVelSet]
type = HitVelSet
trigger1 = !Time
x = 1

[State 153, VelSet]
type = VelSet
trigger1 = Time = GetHitVar(SlideTime)
trigger2 = HitOver
x = 0

[State 153, CtrlSet]
type = CtrlSet
trigger1 = Time = GetHitVar(CtrlTime)
value = 1

[State 153, Standing to Crouching]
type = StateTypeSet
trigger1 = !AILevel && StateType = S && (NumExplod(90000002) || NumExplod(90000001) || NumExplod(90000003))
trigger2 = AILevel && Random < (250 * (AILevel ** 2 / 64.0))
trigger2 = StateType = S && (EnemyNear, MoveType = A) && (EnemyNear, StateType = C)
stateType = C
physics = C

[State 153, Crouching to Standing]
type = StateTypeSet
trigger1 = !AILevel && StateType = C && (!NumExplod(90000002) && !NumExplod(90000001) && !NumExplod(90000003))
trigger2 = AILevel && Random < (125 * (AILevel ** 2 / 64.0))
trigger2 = StateType = C && (EnemyNear, MoveType = A) && (EnemyNear, StateType != C)
stateType = S
physics = S

[State 153, End]
type = ChangeState
trigger1 = HitOver
value = 131
ctrl = 1

;---------------------------------------------------------------------------
;Hit while Guarding (Jumping)
[StateDef 154]
type = A
moveType = H
physics = N
velSet = 0,0

[State 154, ChangeAnim]
type = ChangeAnim
trigger1 = 1
value = 152

[State 154, End]
type = ChangeState
trigger1 = HitShakeOver
value = 155

;---------------------------------------------------------------------------
;Knocked Back while Guarding (Jumping)
[StateDef 155]
type = A
moveType = H
physics = N
anim = 152

[State 155, HitVelSet]
type = HitVelSet
trigger1 = !Time
x = 1
y = 1

[State 155, VelAdd]
type = VelAdd
trigger1 = 1
y = const(movement.yAccel)

[State 155, CtrlSet]
type = CtrlSet
trigger1 = Time = GetHitVar(CtrlTime)
value = 1

[State 155, VarSet]
type = VarSet
trigger1 = 1
sysvar(0) = (pos y >= 0 && vel y > 0)

[State 155, VelSet]
type = VelSet
trigger1 = sysvar(0)
y = 0

[State 155, PosSet]
type = PosSet
trigger1 = sysvar(0)
y = 0

[State 155, End]
type = ChangeState
trigger1 = sysvar(0) && InGuardDist
trigger1 = (!AILevel && ((ifElse(P2dist x < 0, Facing = -1, Facing = 1) && (NumExplod(90000004) + NumExplod(90000001) + NumExplod(90000007) > 0)) || (ifElse(P2dist x < 0, Facing = 1, Facing = -1) && (NumExplod(90000006) + NumExplod(90000003) + NumExplod(90000009) > 0)))) || AILevel
value = 130

[State 155, End]
type = ChangeState
trigger1 = sysvar(0)
value = 52
;---------------------------------------------------------------------------
; LOSE (Time over)
[Statedef 170]
type = S
ctrl = 0
anim = 170
velset = 0,0

[State 170, 1]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

;---------------------------------------------------------------------------
; DRAWGAME (Time over)
[Statedef 175]
type = S
ctrl = 0
velset = 0,0

[State 175, 1] ; If no anim, use go to lose state.
type = ChangeState
trigger1 = Time = 0
trigger1 = !SelfAnimExist(175)
value = 170

[State 175, 2]
type = ChangeAnim
trigger1 = Time = 0
value = 175

[State 175, 3]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1
;---------------------------------------------------------------------------
;Round Win
[Statedef 189]
type = S
ctrl = 0
anim = 5010
velset = 0,0

[State 0, SelfState]
type = Null
trigger1 = Time = 25
value = 170
;---------------------------------------------------------------------------
; PREINTRO
[Statedef 190]
type = S
ctrl = 0
velset = 0,0

[State 190, 1]
type = ChangeAnim
trigger1 = SelfAnimExist(190)
value = 190

[State 190, 2] ;Go straight to intro.
type = ChangeState
triggerall = !NumPartner
trigger1 = Time = 0
value = 191

[State 190, 2] ;Go straight to intro.
type = ChangeState
triggerall = NumPartner
triggerall = ID = 56 || ID = 58
trigger1 = Time = 0
value = 191

[State 190, 2] ;Go straight to intro.
type = ChangeState
triggerall = NumPartner
triggerall = ID = 57 || ID = 59
trigger1 = Time = 0
value = 195

;---------------------------------------------------------------------------
; INTRO (override this state to give character an intro)
[Statedef 191]
type = S
ctrl = 0

[State 191, 1]
type = ChangeState
trigger1 = Time = 0
value = 0

;---------------------------------------------------------------------------
; PAUSE
[Statedef 800]
type = A
physics = N
anim = 1
ctrl = 0

[State 800, 1]
type = RemoveExplod
trigger1 = Time = 0

[State 800, 2]
type = AssertSpecial
trigger1 = 1
flag = nobardisplay
flag2 = timerfreeze
flag3 = nomusic
ignorehitpause = 1
persistent = 1

[State 800, 4]
type = ChangeState
triggerall = NumHelper(805)
trigger1 = Command = "start"
trigger2 = helper(805),Var(10) = 2 && ((Command = "a" && root,Var(44) = 0) ^^ (Command = "b" && root,Var(44)))
value = 801
ignorehitpause = 1

[State 800, 2]
type = Explod
trigger1 = Time = 10
anim = F800
ID = 800
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -1
scale = 1,1
sprpriority = 4
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 800, 3]
type = Helper
trigger1 = Time = 32
name = "Menu"
ID = 805
stateno = 805
pos = 0,0
postype = p1
facing = 1
keyctrl = 1
ownpal = 1
supermovetime = 999999
pausemovetime = 999999
ignorehitpause = 1


[State 800, 5]
type = Helper
trigger1 = !Time
name = "Pause"
ID = 840
stateno = 840
pos = 0,0
postype = left
facing = 1
keyctrl = 0
ownpal = 1
supermovetime = 9999
pausemovetime = 9999
ignorehitpause = 1

[State 800, 6]
type = PlaySnd
trigger1 = !Time
value = S800,0
ignorehitpause = 1

[State 800, 7]
type = Null
trigger1 = Time = 10
anim = 822
ID = 822
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

;---------------------------------------------------------------------------
; PAUSE (End)
[Statedef 801]
type = A
physics = N
anim = 1
ctrl = 0

[State 801, 1]
type = AssertSpecial
trigger1 = Time < 15
flag = nobardisplay
flag2 = timerfreeze
flag3 = nomusic
ignorehitpause = 1
persistent = 1

[State 801, 2]
type = RemoveExplod
trigger1 = !Time
ignorehitpause = 1

[State 801, 3]
type = Pause
trigger1 = !Time
time = 15
endcmdbuftime = 0
pausebg = 1
movetime = 15

[State 801, 4]
type = Explod
trigger1 = !Time
anim = F801
ID = 801
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 802, 5]
type = PlaySnd
trigger1 = !Time
value = S800,0
ignorehitpause = 1

[State 802, 6]
type = DestroySelf
trigger1 = Time = 16
ignorehitpause = 1
;---------------------------------------------------------------------------
; PAUSE
[Statedef 804]
type = A
physics = N
anim = 1
ctrl = 0

[State 804, 1]
type = DestroySelf
trigger1 = !Time
;---------------------------------------------------------------------------
; PAUSE (Menu)
[Statedef 805]
type = A
physics = N
anim = 1
ctrl = 0

[State 805, 10]
type = RemoveExplod
trigger1 = Command = "start"
trigger2 = Var(10) = 2 && ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
ignorehitpause = 1
persistent = 1

[State 805, 10]
type = ChangeState
trigger1 = Command = "start"
trigger2 = Var(10) = 2 && ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
value = 830

[State 805, 2]
type = VarSet
trigger1 = !Time
var(10) = 0
ignorehitpause = 1

[State 805, 3]
type = VarSet
triggerall = NumHelper(807)
trigger1 = helper(807),stateno = 807
var(1) = 0
ignorehitpause = 1

[State 805, 4]
type = VarSet
triggerall = NumHelper(807)
trigger1 = helper(807),stateno = 808
var(1) = 1
ignorehitpause = 1

[State 805, 5]
type = Explod
trigger1 = PrevStateNo = 810||PrevStateNo = 812||PrevStateNo = 814||PrevStateNo = 820
trigger1 = Time = 16
trigger2 = PrevStateNo != 810 && PrevStateNo != 812 && PrevStateNo != 814 && PrevStateNo != 820
trigger2 = !Time
anim = F802
ID = 802
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 805, 5]
type = Explod
trigger1 = PrevStateNo = 810||PrevStateNo = 812||PrevStateNo = 814||PrevStateNo = 820
trigger1 = Time = 16
trigger2 = PrevStateNo != 810 && PrevStateNo != 812 && PrevStateNo != 814 && PrevStateNo != 820
trigger2 = !Time
anim = F805
ID = 805
pos = 120,80
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 805, 6]
type = Explod
trigger1 = PrevStateNo = 810||PrevStateNo = 812||PrevStateNo = 814||PrevStateNo = 820
trigger1 = Time = 16
trigger2 = PrevStateNo != 810 && PrevStateNo != 812 && PrevStateNo != 814 && PrevStateNo != 820
trigger2 = !Time
anim = F875+(2*(root,Var(44)))
ID = 875
pos = 8,176
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 805, 7]
type = Helper
trigger1 = PrevStateNo = 810||PrevStateNo = 812||PrevStateNo = 814||PrevStateNo = 820
trigger1 = Time = 24
trigger2 = PrevStateNo != 810 && PrevStateNo != 812 && PrevStateNo != 814 && PrevStateNo != 820
trigger2 = Time = 8
name = "Arrow"
ID = 807
stateno = 807
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 1
ownpal = 1
pausemovetime = 999999
supermovetime = 999999
ignorehitpause = 1

[State 805, 8]
type = ChangeState
trigger1 = Var(10) < 2 && ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
value = 806
ctrl = 0
ignorehitpause = 1

[State 805, 9]
type = ChangeState
trigger1 = Var(10) >= 2 && ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
value = 801
ctrl = 0
ignorehitpause = 1

;---------------------------------------------------------------------------
; PAUSE (Option Selected)
[Statedef 806]
type = A
physics = N
anim = 1
ctrl = 0

[State 806, 2]
type = RemoveExplod
trigger1 = !Time
id = 802
ignorehitpause = 1

[State 806, 2]
type = RemoveExplod
trigger1 = !Time
id = 805
ignorehitpause = 1

[State 806, 3]
type = RemoveExplod
trigger1 = !Time
id = 875
ignorehitpause = 1

[State 806, 10]
type = ChangeState
trigger1 = Command = "start" 
value = 830

[State 806, 4]
type = Explod
trigger1 = PrevStateNo = 805 && !Time
anim = F803
ID = 803
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 806, 5]
type = Explod
trigger1 = PrevStateNo = 805 && !Time
anim = F806
ID = 806
pos = 120,80
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 808, 6]
type = Explod
trigger1 = PrevStateNo = 805 && !Time
anim = F876+(2*(root,Var(44)))
ID = 876
pos = 8,176
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 806, 7]
type = ChangeState
trigger1 = !Var(10) && Time = 16
value = 810
ignorehitpause = 1

[State 806, 8]
type = ChangeState
trigger1 = Var(10) = 1 && Time = 16
value = 820
ignorehitpause = 1

[State 806, 9]
type = ChangeState
trigger1 = Var(10) = 2 && Time = 16
value = 801
ignorehitpause = 1
 
;---------------------------------------------------------------------------
; PAUSE (Arrow Controls)
[Statedef 807]
type = A
physics = N
anim = 1
ctrl = 0

[State 807, 2]
type = RemoveExplod
trigger1 = !Time
id = 808
ignorehitpause = 1

[State 807, 5]
type = RemoveExplod
trigger1 = Command = "start" || ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
trigger2 = parent,StateNo = 806
persistent = 1
ignorehitpause = 1

[State 807, 6]
type = ChangeState
trigger1 = Command = "start" || ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
trigger2 = parent,StateNo = 806
value = 830
persistent = 1
ignorehitpause = 1

[State 807, 1]
type = ParentVarSet
trigger1 = parent,Var(10) = 1
v = 10
value = 0
ignorehitpause = 1

[State 807, 3]
type = Explod
trigger1 = !Time
anim = F807
ID = 807
pos = 120,88
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ownpal = 1
ontop = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 807, 4]
type = ChangeState
trigger1 = Time >= 1 && Command = "down"
value = 808
ignorehitpause = 1


;---------------------------------------------------------------------------
; PAUSE (Arrow Movelist)
[Statedef 808]
type = A
physics = N
anim = 1
ctrl = 0

[State 808, 7]
type = RemoveExplod
trigger1 = Command = "start" || ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
trigger2 = parent,StateNo = 806
ignorehitpause = 1
persistent = 1

[State 808, 8]
type = ChangeState
trigger1 = Command = "start" || ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
value = 830
ignorehitpause = 1
persistent = 1

[State 808, 1]
type = ParentVarSet
trigger1 = parent,Var(10) = 0 || parent,Var(10) = 2
v = 10
value = 1
ignorehitpause = 1

[State 808, 2]
type = RemoveExplod
trigger1 = !Time
id = 807
ignorehitpause = 1

[State 808, 3]
type = RemoveExplod
trigger1 = !Time
id = 809
ignorehitpause = 1

[State 808, 4]
type = Explod
trigger1 = !Time
anim = F807
ID = 808
pos = 120,112
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ownpal = 1
ontop = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
ignorehitpause = 1

[State 808, 5]
type = ChangeState
trigger1 = Time >= 1 && Command = "up"
value = 807
ignorehitpause = 1

[State 808, 6]
type = ChangeState
trigger1 = Time >= 1 && Command = "down"
value = 809
ignorehitpause = 1

;---------------------------------------------------------------------------
; PAUSE (Arrow Exit)
[Statedef 809]
type = A
physics = N
anim = 1
ctrl = 0

[State 808, 6]
type = RemoveExplod
trigger1 = Command = "start" || ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
trigger2 = parent,StateNo = 806
ignorehitpause = 1
persistent = 1

[State 808, 5]
type = ChangeState
trigger1 = Command = "start" || ((Command = "a" && root,Var(44) = 0) || (Command = "b" && root,Var(44)))
value = 830
ignorehitpause = 1
persistent = 1

[State 808, 1]
type = ParentVarSet
trigger1 = parent,Var(10) = 1
v = 10
value = 2
ignorehitpause = 1

[State 808, 2]
type = RemoveExplod
trigger1 = !Time
id = 808
ignorehitpause = 1

[State 808, 3]
type = Explod
trigger1 = !Time
anim = F807
ID = 809
pos = 120,136
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ownpal = 1
ontop = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999
ignorehitpause = 1

[State 808, 4]
type = ChangeState
trigger1 = Time >= 1 && Command = "up"
value = 808
ignorehitpause = 1

;---------------------------------------------------------------------------
; PAUSE (Controls 1)
[Statedef 810]
type = A
physics = N
anim = 1
ctrl = 0

[State 810, 3]
type = RemoveExplod
triggerall = Time > 16
trigger1 = Command = "fwd"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger3 = Command = "start"
id = 810
ignorehitpause = 1

[State 810, 4]
type = RemoveExplod
triggerall = Time > 16
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 818
ignorehitpause = 1

[State 810, 5]
type = Explod
triggerall = Time > 16
trigger1 = Command = "fwd"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
anim = F811+(4*(root,Var(44)))
ID = 811
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 810, 6]
type = Explod
triggerall = Time > 16
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
anim = F819
ID = 819
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 810, 5]
type = ChangeState
trigger1 = Time > 16 && Command = "fwd"
value = 812
ignorehitpause = 1

[State 810, 6]
type = ChangeState
trigger1 = Time > 16 && ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
value = 805
ignorehitpause = 1

[State 810, 7]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1

[State 810, 1]
type = Explod
trigger1 = PrevStateNo = 806 && Time = 8
trigger2 = PrevStateNo = 812 && Time = 16
anim = F810+(4*(root,Var(44)))
ID = 810
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 4
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 810, 2]
type = Explod
trigger1 = PrevStateNo = 806 && Time = 8
trigger2 = PrevStateNo = 812 && Time = 16
anim = F818
ID = 818
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 6
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

;---------------------------------------------------------------------------
; PAUSE (Controls 2)
[Statedef 812]
type = A
physics = N
anim = 1
ctrl = 0

[State 812, 2]
type = RemoveExplod
triggerall = Time > 16
trigger1 = Command = "back" ^^ Command = "fwd"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger3 = Command = "start"
id = 812
ignorehitpause = 1

[State 812, 3]
type = RemoveExplod
triggerall = Time > 16
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 818
ignorehitpause = 1

[State 812, 3]
type = Explod
triggerall = Time > 16
trigger1 = Command = "back" ^^ Command = "fwd"
trigger2 =  ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
anim = F813+(4*(root,Var(44)))
ID = 813
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 812, 4]
type = Explod
triggerall = Time > 16
trigger1 =  ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
anim = F819
ID = 819
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 812, 5]
type = ChangeState
trigger1 = Time > 16 && Command = "back"
value = 810
ignorehitpause = 1

[State 812, 6]
type = ChangeState
trigger1 = Time > 16 && Command = "fwd"
value = 814
ignorehitpause = 1

[State 812, 7]
type = ChangeState
trigger1 = Time > 16 && ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
value = 805
ignorehitpause = 1

[State 812, 8]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1

[State 812, 1]
type = Explod
trigger1 = Time = 16
anim = F812+(4*(root,Var(44)))
ID = 812
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

;---------------------------------------------------------------------------
; PAUSE (Controls 3)
[Statedef 814]
type = A
physics = N
anim = 1
ctrl = 0

[State 814, 2]
type = RemoveExplod
triggerall = Time > 16
trigger1 = Command = "back"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger3 = Command = "start"
id = 814
ignorehitpause = 1

[State 813, 3]
type = RemoveExplod
triggerall = Time > 16
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 818
ignorehitpause = 1

[State 814, 3]
type = Explod
triggerall = Time > 16
trigger1 = Command = "back"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
anim = F815
ID = 815
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 814, 4]
type = Explod
triggerall = Time > 16
trigger1 =  ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
anim = F819
ID = 819
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 814, 5]
type = ChangeState
trigger1 = Time > 16 && Command = "back"
value = 812
ignorehitpause = 1

[State 814, 7]
type = ChangeState
trigger1 = Time > 16 && ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
value = 805
ignorehitpause = 1

[State 814, 8]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1

[State 814, 9]
type = Explod
trigger1 = Time = 16
anim = F814
ID = 814
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

;---------------------------------------------------------------------------
; PAUSE (Movelist)
[Statedef 820]
type = A
physics = N
anim = 1
ctrl = 0

[State 820, 1]
type = Explod
trigger1 = Time = 16
anim = F820
ID = 820
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 820, 2]
type = Explod
trigger1 = Time = 16
anim = F828
ID = 828
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 99999

[State 820, 2]
type = Null
trigger1 = Time = 30
anim = 822
ID = 822
pos = 16,16
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 820, 3]
type = Explod
trigger1 = Time = 24
anim = 835
ID = 835
pos = 0,64
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 820, 4]
type = Explod
trigger1 = Time = 24
anim = 836+(root,Var(3))
ID = 836
pos = 0,176
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 820, 5]
type = Helper
trigger1 = Time = 24
helpertype = normal ;player
name = "Movelist"
ID = 823
stateno = 823
pos = 0,0
postype = p1    ;p2,front,back,left,right
facing = 1
keyctrl = 1
ownpal = 1
supermovetime = 999999
pausemovetime = 999999
ignorehitpause = 1

[State 820, 6]
type = Explod
trigger1 = Time > 20 && ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
anim = F821
ID = 821
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 820, 7]
type = Explod
trigger1 = Time > 20 && ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
anim = F829
ID = 829
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 99999

[State 820, 8]
type = RemoveExplod
triggerall = Time > 20
trigger1 =  ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 820
ignorehitpause = 1

[State 830, 8]
type = Null
triggerall = Time > 20
trigger1 =  ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 822
ignorehitpause = 1

[State 820, 9]
type = RemoveExplod
triggerall = Time > 20
trigger1 =  ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 826
ignorehitpause = 1

[State 820, 12]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 827
ignorehitpause = 1

[State 820, 13]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 828
ignorehitpause = 1

[State 820, 14]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 835
ignorehitpause = 1

[State 820, 15]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 836
ignorehitpause = 1

[State 820, 16]
type = ChangeState
trigger1 = Time > 20 && ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
value = 805
ignorehitpause = 1

[State 820, 17]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1
;---------------------------------------------------------------------------
; PAUSE (Movelist Basics)
[Statedef 823]
type = A
physics = N
anim = 1
ctrl = 0

[State 823, 1]
type = Explod
trigger1 = !Time
anim = F823
ID = 823
pos = 160,32
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 823, 2]
type = Explod
trigger1 = !Time
anim = 830+(40*(root,Var(44)))
ID = 830
pos = 48,72
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 810, 2]
type = Null
trigger1 = PrevStateNo = 806 && Time = 8
trigger2 = PrevStateNo = 812 && Time = 16
anim = F816
ID = 816
pos = 160,0
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 6
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 823, 4]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "fwd"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger3 = Command = "start"
id = 823
ignorehitpause = 1

[State 823, 6]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "fwd"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger3 = Command = "start"
id = 830
ignorehitpause = 1

[State 823, 7]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 828
ignorehitpause = 1

[State 823, 8]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 835
ignorehitpause = 1

[State 820, 9]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 836
ignorehitpause = 1

[State 823, 10]
type = ChangeState
trigger1 = Time > 0 && Command = "fwd"
value = 824

[State 823, 11]
type = DestroySelf
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
ignorehitpause = 1
persistent = 1

[State 823, 12]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1
;---------------------------------------------------------------------------
; PAUSE (Movelist Specials)
[Statedef 824]
type = A
physics = N
anim = 1
ctrl = 0

[State 824, 1]
type = Explod
trigger1 = !Time
anim = F824
ID = 824
pos = 160,32
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 824, 2]
type = Explod
trigger1 = !Time
anim = 831+(40*(root,Var(44)))
ID = 831
pos = 48,72
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 824, 3]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "fwd"
trigger2 =  Command = "back"
trigger3 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger4 = Command = "start"
id = 824
ignorehitpause = 1

[State 824, 4]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "fwd"
trigger2 =  Command = "back"
trigger3 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger4 = Command = "start"
id = 831
ignorehitpause = 1

[State 824, 5]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 828
ignorehitpause = 1

[State 824, 5]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 835
ignorehitpause = 1

[State 824, 6]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 836
ignorehitpause = 1

[State 824, 7]
type = ChangeState
triggerall = Time > 0
trigger1 = Command = "fwd"
trigger2 = Command = "back"
value = 825-(2*Command = "back")
ignorehitpause = 1

[State 824, 8]
type = DestroySelf
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
ignorehitpause = 1
persistent = 1

[State 824, 9]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1
;---------------------------------------------------------------------------
; PAUSE (Movelist EX)
[Statedef 825]
type = A
physics = N
anim = 1
ctrl = 0

[State 825, 1]
type = Explod
trigger1 = !Time
anim = F825
ID = 825
pos = 160,32
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 825, 2]
type = Explod
trigger1 = !Time
anim = 832+(40*(root,Var(44)))
ID = 832
pos = 48,72
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 825, 3]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "fwd"
trigger2 =  Command = "back"
trigger3 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger4 = Command = "start"
id = 825
ignorehitpause = 1

[State 825, 4]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "fwd"
trigger2 =  Command = "back"
trigger3 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger4 = Command = "start"
id = 832
ignorehitpause = 1

[State 825, 5]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 828
ignorehitpause = 1

[State 825, 6]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 835
ignorehitpause = 1

[State 825, 7]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 836
ignorehitpause = 1

[State 825, 8]
type = ChangeState
triggerall = Time > 0
trigger1 = Command = "fwd"
trigger2 = Command = "back"
value = 826-(2*Command = "back")
ignorehitpause = 1

[State 825, 9]
type = DestroySelf
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
ignorehitpause = 1
persistent = 1

[State 825, 10]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1
;---------------------------------------------------------------------------
; PAUSE (Movelist Supers)
[Statedef 826]
type = A
physics = N
anim = 1
ctrl = 0

[State 826, 1]
type = Explod
trigger1 = !Time
anim = F826
ID = 826
pos = 160,32
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 826, 2]
type = Explod
trigger1 = !Time
anim = 833+(40*(root,Var(44)))
ID = 833
pos = 48,72
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 826, 3]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "fwd"
trigger2 =  Command = "back"
trigger3 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger4 = Command = "start"
id = 826
ignorehitpause = 1

[State 826, 4]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "fwd"
trigger2 =  Command = "back"
trigger3 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger4 = Command = "start"
id = 833
ignorehitpause = 1

[State 826, 5]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 828
ignorehitpause = 1

[State 826, 6]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 835
ignorehitpause = 1

[State 826, 7]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 836
ignorehitpause = 1

[State 826, 8]
type = ChangeState
triggerall = Time > 0
trigger1 = Command = "fwd"
trigger2 = Command = "back"
value = 827-(2*Command = "back")
ignorehitpause = 1

[State 826, 9]
type = DestroySelf
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
ignorehitpause = 1
persistent = 1

[State 823, 12]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1
;---------------------------------------------------------------------------
; PAUSE (Movelist Helper)
[Statedef 827]
type = A
physics = N
anim = 1
ctrl = 0

[State 827, 1]
type = Explod
trigger1 = !Time
anim = F827
ID = 827
pos = 160,32
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 827, 2]
type = Explod
trigger1 = !Time
anim = 834
ID = 834
pos = 48,72
postype = left
facing = 1
vfacing = 1
bindtime = 1
removetime = -2
scale = 1,1
sprpriority = 5
ontop = 1
ownpal = 1
ignorehitpause = 1
pausemovetime = 999999
supermovetime = 999999

[State 827, 3]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "back"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger3 = Command = "start"
id = 827
ignorehitpause = 1

[State 827, 4]
type = RemoveExplod
triggerall = Time > 0
trigger1 =  Command = "back"
trigger2 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger3 = Command = "start"
id = 834
ignorehitpause = 1

[State 827, 5]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 828
ignorehitpause = 1

[State 827, 6]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && Var(44)))
trigger2 = Command = "start"
id = 835
ignorehitpause = 1

[State 827, 7]
type = RemoveExplod
triggerall = Time > 0
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
trigger2 = Command = "start"
id = 836
ignorehitpause = 1

[State 827, 8]
type = ChangeState
triggerall = Time > 0
trigger1 = Command = "back"
value = 826
ignorehitpause = 1

[State 827, 9]
type = DestroySelf
trigger1 = ((Command = "b" && root,Var(44) = 0) || (Command = "a" && root,Var(44)))
ignorehitpause = 1
persistent = 1

[State 823, 12]
type = ChangeState
trigger1 = Command = "start"
value = 830
persistent = 1
ignorehitpause = 1
;---------------------------------------------------------------------------
; PAUSE (Menu Clean
[Statedef 830]
type = A
physics = N
anim = 1
ctrl = 0

[State 801, 2]
type = RemoveExplod
trigger1 = 1
ignorehitpause = 1

[State 802, 6]
type = DestroySelf
trigger1 = Time = 1
ignorehitpause = 1
;---------------------------------------------------------------------------
; PAUSE (Pause 1)
[Statedef 840]
type = A
physics = N
anim = 1
ctrl = 0

[State 840, Pause]
type = Pause
trigger1 = !Time
time = 999
movetime = 999
pausebg = 1

[State 840, ChangeState]
type = ChangeState
trigger1 = Time = 999
value = 841

[State 840, DestroySelf]
type = DestroySelf
trigger1 = parent,stateno = 801
ignorehitpause = 1
persistent = 1
;---------------------------------------------------------------------------
; PAUSE (Pause 2)
[Statedef 841]
type = A
physics = N
anim = 1
ctrl = 0

[State 841, Pause]
type = Pause
trigger1 = !Time
time = 999
movetime = 999
pausebg = 1

[State 841, ChangeState]
type = ChangeState
trigger1 = Time = 999
value = 840

[State 841, DestroySelf]
type = DestroySelf
trigger1 = parent,stateno = 801
ignorehitpause = 1
persistent = 1
;---------------------------------------------------------------------------
;Helper Menu
[Statedef 850]
type = A
physics = N
anim = 1
ctrl = 0

[State 850, 1]
type = Explod
trigger1 = !Time && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F850 
ID = 850
pos = 0,0
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -2
ontop = 0
removeongethit = 0

[State 850, 2]
type = Explod
trigger1 = !Time && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F851
ID = 851
pos = 8+144*(Facing = -1),7
postype = back 
facing = ifelse(Facing = -1, -1,1)
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -1
ontop = 0
removeongethit = 0

[State 850, 3]
type = Explod
trigger1 = !Time && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F852 
ID = 857
pos = 24,15
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -1
ontop = 0
removeongethit = 0

[State 850, 4]
type = Explod
trigger1 = !Time && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F852
ID = 858
pos = 64,15
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -1
ontop = 0
removeongethit = 0

[State 850, 5]
type = Explod
trigger1 = !Time && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F852 
ID = 859
pos = 104,15
postype = back  
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -1
ontop = 0
removeongethit = 0

[State 850, 6]
type = ChangeState
trigger1 = Time = 1 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
value = 851

[State 850, 6]
type = ChangeState
trigger1 = Time = 1 && (enemy,Name = "BONUS" && enemy,AILevel != 0)
value = 852
;---------------------------------------------------------------------------
;Helper Menu (Icons)
[Statedef 851]
type = A
physics = N
anim = 1
ctrl = 0
sprpriority = 1

[State 851, 1]
type = Explod
triggerall = !NumExplod(853) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
trigger1 = parent,Var(3) = 0
anim = F853 
ID = 853
pos = 24,15
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
triggerall = !NumExplod(854) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
trigger1 = parent,Var(3) = 1
anim = F853 
ID = 854
pos = 64,15
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
triggerall = !NumExplod(855) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
trigger1 = parent,Var(3) = 2
anim = F853 
ID = 855
pos = 104,15
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = !NumExplod(7090) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = 7090 
ID = 7090
pos = 25,16
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = !NumExplod(7190) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = 7190
ID = 7190
pos = 65,16
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = !NumExplod(7290) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = 7290 
ID = 7290
pos = 105,16
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = root,Var(32) = 180 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F857
ID = 857
pos = 153,24
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = root,Var(32) = 180 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F858
ID = 858
pos = 161,24
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 2]
type = RemoveExplod
trigger1 = 1
id = 853+((parent,Var(3)) - 1)

[State 851, 3]
type = RemoveExplod
trigger1 = 1
id = 853+(parent,Var(3) + 1)

[State 851, 5]
type = ParentVarAdd
triggerall = !var(59) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
trigger1 = Command = "fwd" && parent,Var(3) < 2
v = 3  
value = 1

[State 851, 6]
type = ParentVarAdd
triggerall =! var(59) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
trigger1 = Command = "back" && parent,Var(3) > 0
v = 3  
value = -1

[State 0, VarRandom]
type = VarRandom
trigger1 = var(59) && !Time && (enemy,Name != "BONUS" || enemy,AILevel = 0) && root,RoundsExisted = 0
v = 1
range = 0,2

[State 0, ParentVarAdd]
type = ParentVarAdd
trigger1 = var(59) && !Time && (enemy,Name != "BONUS" || enemy,AILevel = 0) && root,RoundsExisted = 0
v = 3
value = var(1)

[State 0, PlaySnd]
type = PlaySnd
trigger1 = root,Var(32) % 60 = 0 && root,Var(32) != 0 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
value = F850,0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = root,Var(32) = 0 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
value = F799,0
persistent = 0

[State 851, ChangeState]
type = ChangeState
trigger1 = !Var(59) && (Command = "a" || Command = "b" || Command = "start" || Command = "c")
trigger2 = (root,Var(32) = 0) || (enemy,Name = "BONUS" && enemy,AILevel != 0)
value = 852
;---------------------------------------------------------------------------
;Helper Menu (Close)
[Statedef 852]
type = A
physics = N
anim = 1
ctrl = 0
sprpriority = 1

[State 852, 1]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 851

[State 852, 2]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 853

[State 852, 3]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 854

[State 852, 4]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 855

[State 852, 5]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 857

[State 852, 6]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 858

[State 852, 7]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 859

[State 852, 8]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0

[State 852, 9]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 7190

[State 852, 10]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 7290

[State 852, 11]
type = RemoveExplod
trigger1 = RoundState = 2
id = 850

[State 850, 12]
type = Explod
trigger1 = root,StateNo = 0 && P2StateNo = 0
trigger2 = root,StateNo = 0 && P2StateNo = 0 && (enemy,Name = "BONUS" && TeamSide = 1)
anim = F850 
ID = 852
pos = 0,0
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = 60
pausemovetime = 999
scale = 1,1
sprpriority = -2
ontop = 0
removeongethit = 0

[State 852, 14]
type = DestroySelf
trigger1 = RoundState = 2
;---------------------------------------------------------------------------
;Helper Menu
[Statedef 853]
type = A
physics = N
anim = 1
ctrl = 0

[State 850, 1]
type = Explod
trigger1 = Time = 0 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F850 
ID = 850
pos = 0,0
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -2
ontop = 0
removeongethit = 0

[State 850, 2]
type = Explod
trigger1 = Time = 0 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F856 
ID = 851
pos = 8+144*(Facing = -1),7
postype = back 
facing = ifelse(Facing = -1, -1,1)
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -1
ontop = 0
removeongethit = 0

[State 850, 3]
type = Explod
trigger1 = Time = 0 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F852 
ID = 857
pos = 24,15
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -1
ontop = 0
removeongethit = 0

[State 850, 4]
type = Explod
trigger1 = Time = 0 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F852
ID = 858
pos = 64,15
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -1
ontop = 0
removeongethit = 0

[State 850, 5]
type = Explod
trigger1 = Time = 0 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F852 
ID = 859
pos = 104,15
postype = back  
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -1
ontop = 0
removeongethit = 0

[State 850, 6]
type = ChangeState
trigger1 = Time = 1
value = 854
;---------------------------------------------------------------------------
;Helper Menu (Icons)
[Statedef 854]
type = A
physics = N
anim = 1
ctrl = 0
sprpriority = 1

[State 851, 1]
type = Explod
trigger1 = !NumExplod(7090) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F859
ID = 7090
pos = 25,16
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = !NumExplod(7190) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F859
ID = 7190
pos = 65,16
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = !NumExplod(7290) && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F859
ID = 7290
pos = 105,16
postype = back
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = root,Var(32) = 180 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F857
ID = 857
pos = 153,24
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 851, 1]
type = Explod
trigger1 = root,Var(32) = 180 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
anim = F858
ID = 858
pos = 161,24
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = 999
scale = 1,1
sprpriority = 1
ontop = 0
removeongethit = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = root,Var(32) % 60 = 0 && root,Var(32) != 0 && (enemy,Name != "BONUS" || enemy,AILevel = 0)
value = F850,0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = root,Var(32) = 0  && (enemy,Name != "BONUS" || enemy,AILevel = 0)
value = F799,0
persistent = 0

[State 851, ChangeState]
type = ChangeState
trigger1 = !Var(59) && (Command = "a" || Command = "b" || Command = "start" || Command = "c")
trigger2 = (root,Var(32) = 0) || (enemy,Name = "BONUS" && enemy,AILevel != 0)
value = 855
;---------------------------------------------------------------------------
;Helper Menu (Close)
[Statedef 855]
type = A
physics = N
anim = 1
ctrl = 0
sprpriority = 1

[State 852, 1]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 851

[State 852, 1]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 857

[State 852, 1]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 858

[State 852, 1]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 859

[State 852, 1]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 7090

[State 852, 1]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 7190

[State 852, 1]
type = RemoveExplod
trigger1 = root,StateNo = 0 && P2StateNo = 0
id = 7290

[State 852, 1]
type = RemoveExplod
trigger1 = RoundState = 2
id = 850

[State 850, 1]
type = Explod
trigger1 = root,StateNo = 0 && P2StateNo = 0 && !(enemy,Name = "BONUS")
trigger2 = P2StateNo = 0 && (enemy,Name = "BONUS" && TeamSide = 1)
anim = F850 
ID = 852
pos = 0,0
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = 60
pausemovetime = 999
scale = 1,1
sprpriority = -5
ontop = 0
removeongethit = 0

[State 852, 3]
type = DestroySelf
trigger1 = RoundState = 2
;---------------------------------------------------------------------------
;Round Helper
[Statedef 860]
type = A
physics = N
anim = 1
ctrl = 0

[State 860, 1]
type = Explod
triggerall = NumExplod(860) = 0
triggerall = RoundNo >= 2 && root,StateNo != [180,189]
trigger1 = RoundState < 2
anim = F850 
ID = 860
pos = 0,0
postype = back 
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = 999
scale = 1,1
sprpriority = -2
ontop = 0
removeongethit = 0

[State 0, RemoveExplod]
type = RemoveExplod
triggerall = NumEnemy
trigger1 = (RoundState = 2 && root,Ctrl = 1) || (RoundState = 2 && (enemy,Ctrl = 1 || (enemy,Name = "Bonus" && enemy,StateNo = 1)))
id = 860

[State 860, 2]
type = DestroySelf
triggerall = NumEnemy
trigger1 = (RoundState = 2 && root,Ctrl = 1) || (RoundState = 2 && (enemy,Ctrl = 1 || (enemy,Name = "Bonus" && enemy,StateNo = 1)))

;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 5000]
type    = S
movetype= H
physics = N
velset = 0,0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5000, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5000, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5000, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5000, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5000, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5000, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5000, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

[State -2, PosSet]
type = PosSet
trigger1 = !Time
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
y = 0

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

[State 5000, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

;---------------------------------------------------------------------------
; Stand get-hit (knocked back)
[Statedef 5001]
type    = S
movetype= H
physics = S

[State 5001, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5001, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5005 + GetHitVar(animtype) + (GetHitVar(groundtype)=2)*10

[State 5001, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5001, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5001, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5001, 6]
type = ChangeState
trigger1 = HitOver
value = 0
ctrl = 1

;---------------------------------------------------------------------------
; Crouch get-hit (shaking)
[Statedef 5010]
type    = C
movetype= H
physics = N
velset = 0,0

[State 5010, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = 5020 + GetHitVar(animtype)

[State 5010, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5010, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5010, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5010, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
triggerall = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5010, 6]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5011 ;Crouch get-hit (knocked back)

[State 5010, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5010, FFB Light]
type = ForceFeedback
trigger1 = anim = 5020
persistent = 0
time = 6
waveform = square

[State 5010, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5021
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5010, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5022
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; Crouch get-hit (knocked back)
[Statedef 5011]
type    = C
movetype= H
physics = C

[State 5011, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5011, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
value = 5025 + GetHitVar(animtype)

[State 5011, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5011, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5011, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5011, 6]
type = ChangeState
trigger1 = HitOver
value = 11
ctrl = 1

;---------------------------------------------------------------------------
; Air get-hit (shaking)
[Statedef 5020]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5020, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(airtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5020, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5020, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5020, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver
value = 5030

[State 5020, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5020, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5020, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
trigger4 = anim = [5051,5059]
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; Air get-hit (knocked away)
[Statedef 5030]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = ChangeAnim
trigger1 = Anim != [5000, 5199]
trigger1 = SelfAnimExist(5030)
value = 5030

[State 5030, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5030, 3]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5030, 4]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Const(movement.air.gethit.groundlevel)
value = 5050 ;HITA_FALL

[State 5030, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 5035 ;Air get-hit (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5035]
type    = A
movetype= H
physics = N

[State 5035, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
trigger1 = Anim != 5420 && Anim != 5470
value = 5035

[State 5035, 2]
type = VelAdd
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5035, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Animation over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5040 ;HITA_RECOV

[State 5035, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5050 ;HITA_FALL

;---------------------------------------------------------------------------
; HITA_RECOV (recovering in air, not falling)
[Statedef 5040]
type    = A
movetype= H
physics = N

[State 5040, 1]
type = ChangeState
trigger1 = !Alive
value = 5050

[State 5040, 2]
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim != 5040
trigger2 = Time = 0
trigger2 = Anim != 5035
value = 5040

[State 5040, 3]
type = CtrlSet
trigger1 = HitOver
value = 1

[State 5040, 4]
type = StateTypeSet
trigger1 = HitOver
movetype = I

[State 5040, 5]
type = VelAdd
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5040, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;JUMPLAND

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5050]
type    = A
movetype= H
physics = N

[State 5050, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
trigger2 = Anim != 5420 && Anim != 5470
value = 5050

[State 5050, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5050, 3] ;Gravity
type = VelAdd
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5050, 4] ;Recover near ground
type = Null
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 5050, 5]; Recover in mid air
type = Null
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER

[State 5050, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]) || (anim = [25400,25499]), 0, Const(movement.air.gethit.groundlevel))
value = 5100 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; HIT_TRIP (shaking)
[Statedef 5070]
type    = A
movetype= H
physics = N
velset = 0,0

[State 5070, 1]
type = ChangeAnim 
trigger1 = 1
value = 5070

[State 5070, 2]
type = ChangeState
trigger1 = HitShakeOver
value = 5071

[State 5070, 3]
type = ForceFeedback
trigger1 = time = 0
time = 12
waveform = sinesquare
ampl = 140

;---------------------------------------------------------------------------
; HIT_TRIP2 (fall through air)
[Statedef 5071]
type    = A
movetype= H
physics = N

[State 5071, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5071, 2] ;Acceleration
type = VelAdd
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5071, 3] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 15
type = ChangeState
value = 5810

;---------------------------------------------------------------------------
; HITL_SHAKE
[Statedef 5080]
type    = L
movetype= H
physics = N
velset = 0,0

[State 5080, 1] ;Set default anim
type = VarSet
trigger1 = time = 0
sysvar(2) = ifelse (GetHitVar(yvel) = 0, 5080, 5090)

[State 5080, 2]
type = VarAdd
trigger1 = time = 0
trigger1 = (anim = [5081,5089]) || (anim = [5111,5119])
trigger1 = SelfAnimExist(sysvar(2) + (anim % 10))
sysvar(2) = anim % 10

[State 5080, 3] ;If 5090 doesn't exist, default to 5030
type = VarSet
trigger1 = time = 0
trigger1 = sysvar(2) = 5090
trigger1 = !SelfAnimExist(5090)
sysvar(2) = 5030

[State 5080, 3] ;Freeze
type = ChangeAnim
trigger1 = 1
value = sysvar(2)

[State 5080, 4]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0
value = 5081 ;HITL_SLIDE

[State 5080, 5]
type = ChangeState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) != 0
value = 5030 ;HITA_UP

;---------------------------------------------------------------------------
; HITL_SLIDE
[Statedef 5081]
type    = L
movetype= H
physics = C

[State 5081, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5081, 2]
type = VelSet
trigger1 = HitOver
x = 0

[State 5081, 3] ;Don't show hit ground frame
type = VarSet
trigger1 = Time = 0
sysvar(0) = 1

[State 5081, 4]
type = ChangeState
trigger1 = HitOver
value = ifelse(GetHitVar(fall.recovertime) = 1, 5810, 5110)

;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 5100]
type    = L
movetype= H
physics = N

[State 5100, 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 5100, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5100, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 5100, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 5100, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 5100, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5100, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5100, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 5100, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = ifelse(GetHitVar(fall.recovertime) = 1, 5810, 5110) ;HIT_LIEDOWN

[State 5100, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5100, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 5100, 10]
type = PlaySnd
trigger1 = Time = 1 && GetHitVar(fall.recovertime) != 1
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5100, 11]
type = PlaySnd
trigger1 = Time = 1 && GetHitVar(fall.recovertime) = 1
value = F8,0

[State 5100, 12]
type = PosFreeze
trigger1 = 1

[State 5100, 13]
type = ChangeState
trigger1 = AnimTime = 0
value = 5101

[State 5100, 14]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20

;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 5101]
type    = L
movetype= H
physics = N

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

[State 5101, 4]
type = PosSet
trigger1 = Time = 0
y = 20

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 5101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = ChangeState
value = ifelse(GetHitVar(fall.recovertime) = 1, 5810, 5110)

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5110]
type    = L
movetype= H
physics = N

[State 5110, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5110, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 5110, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 5110, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)

[State 5110, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5110, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5110, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5110, 6]
type = PlaySnd
trigger1 = Time = 0 && !GetHitVar(fall.recovertime) != 1
trigger1 = !SysVar(0)
value = F7, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5100, 11]
type = PlaySnd
trigger1 = Time = 1 && GetHitVar(fall.recovertime) = 1
value = F8,0

[State 5110, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5110, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5110, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 5110, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5110, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5110, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5110, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5110, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5110, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

;---------------------------------------------------------------------------
; HIT_GETUP
[Statedef 5120]
type    = L
movetype= H
physics = N

[State 5120, 1a] ;Get up anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5111,5119]
trigger2 = !SelfAnimExist(5120 + (anim % 10))
value = 5120

[State 5120, 1b] ;Get up anim (for hit up/diag-up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5111,5119]
trigger1 = SelfAnimExist(5120 + (anim % 10))
value = 5120 + (anim % 10)

[State 5120, 2]
type = VelSet
trigger1 = Time = 0
x = 0

[State 5120, 3]
type = Null
trigger1 = 1
value = SCA
time = 1

[State 5120, 4]
type = HitFallSet
trigger1 = AnimTime = 0
value = 1

[State 5120, 5] ;Can't be thrown right after getting up
type = NotHitBy
trigger1 = AnimTime = 0
value = , NT,ST,HT
time = 7

[State 5120, 6] ;Can't be hit right after getting up (short time)
type = NotHitBy
trigger1 = AnimTime = 0
value2 = SCA
time = 1

[State 5120, 7]
type = AssertSpecial
trigger1 = (GameTime % 2) = 1
flag = invisible

[State 5120, 8]
type = ChangeState
trigger1 = AnimTime = 0
value = 0
ctrl = 1
;---------------------------------------------------------------------------
; HIT_LIEDEAD
[Statedef 5150]
type    = L
movetype= H
physics = N
sprpriority = -3

[State 5150, 1] ;Normal anim
type = ChangeAnim
triggerall = Time = 0
triggerall = SelfAnimExist(5140)
trigger1 = (anim != [5111,5119]) && (anim != [5171,5179])
trigger2 = !SelfAnimExist(5140 + (anim % 10))
value = 5140

[State 5150, 3] ;Hit up type anim
type = ChangeAnim
trigger1 = Time = 0
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
trigger1 = SelfAnimExist(5140 + (anim % 10))
value = 5140 + (anim % 10)

[State 5150, 4] ;Match over anim
type = ChangeAnim
persistent = 0
;trigger1 = Time = 0
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10

[State 5150, 5] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
trigger1 = Time = 0
trigger1 = Anim != [5140,5159]
trigger1 = Anim != [5110,5119]
value = 5110

[State 5150, 6] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5150, 7] ;Friction
type = VelSet
trigger1 = Vel x < .05
persistent = 0
x = 0

[State 5150, 8]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 5150, 9]
type = AssertSpecial
trigger1 = PrevStateNo = 5400
flag = noshadow

[State 5150, 10]
type = VelSet
trigger1 =  PrevStateNo = 5400
x = 0
y = 0

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (still falling)
[Statedef 5200]
type    = A
movetype= H
physics = N

[State 5200, 1] ;Change anim if done with transition
type = ChangeAnim
trigger1 = Anim = 5035
trigger1 = AnimTime = 0
value = 5050

[State 5200, 2]
type = VelAdd
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5200, 3]
type = SelfState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 10
value = 5201

;---------------------------------------------------------------------------
; HIT_FALLRECOVER (on the ground)
[Statedef 5201]
type    = A
movetype= H
physics = A
anim = 5200

[State 5201, 1] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -5

[State 5201, 2]
type = VelSet
trigger1 = Time = 0
x = -.15
y = -3.5

[State 5201, 3]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5201, 4]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 5201, 5] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 128,128,128 ;256,256,256

[State 5201, 6]
type = GameMakeAnim
trigger1 = Time = 1
value = 60
pos = 0, 0
under = 1

;---------------------------------------------------------------------------
; HIT_AIRFALLRECOVER
[Statedef 5210]
type    = A
movetype= I
physics = N
anim = 5210
ctrl = 0

[State 5210, 1] ;Blink white
type = PalFX
trigger1 = Time = 0
time = 3
add = 256,256,256

[State 5210, 1]
type = PosFreeze
trigger1 = Time = 0
value = 4

[State 5210, 2] ;Turn if not facing opponent
type = Turn
trigger1 = Time = 0
trigger1 = p2dist X < -20

[State 5210, 1] 
type = VelMul
trigger1 = Time = 4
x = .8
y = .8

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
y = -4.5

[State 5210, 1] 
type = VelMul
trigger1 = Time = 4
trigger1 = Vel Y > 0
y = .5

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -3
y = -2

[State 5210, 1]
type = VelAdd
trigger1 = Time = 4
trigger1 = Vel Y > -2
y = -1

[State 5210, 2] ;Go up
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdup"
y = -2

[State 5210, 2] ;Go down
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holddown"
y = 1.5

[State 5210, 2] ;Go fwd
type = VelMul
trigger1 = Time = 4
trigger1 = Command = "holdfwd"
x = 1

[State 5210, 2] ;Go back
type = VelAdd
trigger1 = Time = 4
trigger1 = Command = "holdback"
x = -1

[State 5210, 3]
type = NotHitBy
trigger1 = Time = 0
value = SCA
time = 15

[State 5210, 4]
type = CtrlSet
trigger1 = Time = 20
value = 1

[State 5210, 5]
type = VelAdd;Gravity
trigger1 = Time >= 4
y = .35

[State 5210, 5] ;Land on ground
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 52 ;JUMP_LAND
ctrl = 1
;---------------------------------------------------------------------------
;BURNED HITG_SHAKE
[Statedef 5400]
type    = U
movetype= H
physics = N
velset = 0,0

[State 5400, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = Cond(SelfAnimExist(25400),ifelse(StateType != C,25400,25410),ifelse(StateType != C,5400,5410))

[State 5400, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = Cond(SelfAnimExist(25400),25420,5420)

[State 5400, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5400, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5400, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5401 ;HITG_SLIDE

[State 5400, 7]
type = SelfState
trigger1 = HitShakeOver
value = 5420

[State 5400, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5400, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5400, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140
;---------------------------------------------------------------------------
; HITG_SLIDE
[Statedef 5401]
type    = S
movetype= H
physics = S

[State 5401, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5401, 3] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5401, 4]
type = VelSet
trigger1 = HitOver
x = 0

[State 5401, 5]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5401, 6]
type = ChangeState
trigger1 = HitOver
value = 0
ctrl = 1
;---------------------------------------------------------------------------
;BURNED HITA_UP (initial going up)
[Statedef 5420]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = VelAdd;Gravity
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5020, 5]
type = ChangeState
trigger1 = HitShakeOver && !GetHitVar(fall)
value = 5430

[State 5050, 3]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;HIT_BOUNCE

;---------------------------------------------------------------------------
; Air get-hit (knocked away)
[Statedef 5430]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5030, 3]
type = ChangeState
triggerall = !HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Const(movement.air.gethit.groundlevel)
value = 5040 ;HITA_RECOV

[State 5030, 4]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Const(movement.air.gethit.groundlevel)
value = 5450 ;HITA_FALL

[State 5030, 5]
type = ChangeState
trigger1 = AnimTime = 0
value = 5035 ;Air get-hit (transition)

;---------------------------------------------------------------------------
;BURNED HITG_SHAKE
[Statedef 5450]
type    = U
movetype= H
physics = N
velset = 0,0

[State 5450, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = Cond(SelfAnimExist(25450),ifelse(StateType != C,25450,25460),ifelse(StateType != C,5450,5460))

[State 5450, 2] ;Anim for HIT_BACK
type = ChangeAnim
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = Cond(SelfAnimExist(25450),25470,5470)

[State 5450, 4] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5450, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5450, 6]
type = SelfState
trigger1 = HitShakeOver
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5451 ;HITG_SLIDE

[State 5450, 7]
type = SelfState
trigger1 = HitShakeOver
value = 5470

[State 5450, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5450, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5450, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140
;---------------------------------------------------------------------------
; HITG_SLIDE
[Statedef 5451]
type    = S
movetype= H
physics = S

[State 5451, 1]
type = HitVelSet
trigger1 = Time = 0
x = 1

[State 5451, 2] ;Stop sliding back
type = VelMul
trigger1 = Time >= GetHitVar(slidetime)
x = .6

[State 5451, 3]
type = VelSet
trigger1 = HitOver
x = 0

[State 5451, 4]
type = DefenceMulSet
trigger1 = HitOver
value = 1

[State 5451, 5]
type = ChangeState
trigger1 = HitOver
value = 0
ctrl = 1
;---------------------------------------------------------------------------
;BURNED HITA_UP (initial going up)
[Statedef 5470]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5030, 1]
type = VelAdd;Gravity
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5030, 2]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5050, 3]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 0
value = 5100 ;HIT_BOUNCE

;---------------------------------------------------------------------------
;FROZEN HIT_SHAKE
[Statedef 5490]
type    = U
movetype= H
physics = N
velset = 0,0

[State 5450, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(25500) ;AuthorName = "KingPepe" && Var(22)
value = 25500+(10*(StateType = C))

[State 5450, 2] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0
trigger1 = !SelfAnimExist(25500) ;(GetHitVar(animtype) != [3,5]) && (AuthorName != "KingPepe" || !Var(22))
value = 5000+(10*(StateType = C))
elem = 1

;[State 5450, 3] ;Anim for HIT_BACK
;type = ChangeAnim
;trigger1 = Time = 0
;trigger1 = GetHitVar(animtype) = [3,5]
;value = Cond(AuthorName = "KingPepe" && Var(22),25470,Cond(SelfAnimExist(7696),7696,Cond(SelfAnimExist(9010),9010,5030)))

[State 5450, 4]
type = PalFX
trigger1 = !SelfAnimExist(25500) ;(AuthorName != "KingPepe" || !Var(22)) && (Anim = [5000,5099])
time = 1
add = 0,80,256
mul = 0,256,256
sinadd = 0,0,0,1
invertall = 0
color = 256
persistent = 0

[State 5450, 5] ;Freeze anim
type = ChangeAnim
trigger1 = Time > 0
value = anim

[State 5450, 8]
type = ChangeState
trigger1 = HitShakeOver
value = 5491

;---------------------------------------------------------------------------
;FROZEN HIT_STUN
[Statedef 5491]
type    = U
movetype= H
physics = N
velset = 0,0

[State 5450, 2] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = Time = 0 && !SelfAnimExist(25500)
value = Anim
elem = 1

[State 5450, 4]
type = PalFX
trigger1 = !SelfAnimExist(25500) ;(AuthorName != "KingPepe" || !Var(22)) && (Anim = [5000,5099])
time = 1
add = 0,80,256
mul = 0,256,256
sinadd = 0,0,0,1
invertall = 0
color = 256

[State 1013, 3]
type = ChangeState
trigger1 = GetHitVar(hittime) <= 20
value = 5492
;---------------------------------------------------------------------------
;BURNED HITG_SHAKE
[Statedef 5492]
type    = U
movetype= H
physics = N
velset = 0,0

[State 5450, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = (Anim = 25500 || Anim = 25510) && !Time
value = 25502+(10*(StateType = C))
elem = 1

[State 5450, 2] ;Anim for HIT_LIGHT to HIT_HARD
type = ChangeAnim
trigger1 = (Anim = 5000 || Anim = 5010)
value = Anim
elem = 1

[State 5450, 4]
type = PalFX
trigger1 = (Time % 4) = 0 && !SelfAnimExist(25500) ;&&  (AuthorName != "KingPepe" || !Var(22)) && (Anim = [5000,5099])
time = 2
add = 0,80,256
mul = 0,256,256
sinadd = 0,0,0,1
invertall = 0
color = 256

[State 1013, 3]
type = SelfState
trigger1 = GetHitVar(hittime) = -1
value = 0+(5040*(StateType = A))
ctrl = 0+(1*(StateType != A))
;---------------------------------------------------------------------------
; Continue?
[Statedef 5500]
type = S
ctrl = 0
anim = 5300
velset = 0,0

[State 5500, 1] ;Use continue animation if available
type = ChangeAnim
trigger1 = time = 0
trigger1 = SelfAnimExist(5500)
value = 5500

;---------------------------------------------------------------------------
; HIT_STOMPED
[Statedef 5610]
type    = L
movetype= H
physics = N
velset = 0,0
ctrl = 0
sprpriority = -3
anim = 5610

[State 5610, 1]
type = PosSet
trigger1 = Time = 80
y = 999

[State 5610, 2]
type = SelfState
trigger1 = Time = 80
value = 5150
ctrl = 0
;---------------------------------------------------------------------------
; HIT_LIEDEAD (Prevent Death States)
[Statedef 5699]
type    = L
movetype= H
physics = N
sprpriority = -3

[State 5699, 1]
type = VarSet
trigger1 = !Time
var(25) = 1

[State 5699, 2]
type = ChangeState
trigger1 = !Time
value = 5150

[State 5699, 3] ;Normal anim
type = ChangeAnim
triggerall = !Name = "Simon" && !PrevStateNo = 5601
triggerall = Time = 0
triggerall = SelfAnimExist(5140)
trigger1 = (anim != [5111,5119]) && (anim != [5171,5179])
trigger2 = !SelfAnimExist(5140 + (anim % 10))
value = 5140

[State 5699, 4] ;Hit up type anim
type = ChangeAnim
triggerall = !Name = "Simon" && !PrevStateNo = 5601
trigger1 = Time = 0
trigger1 = (anim = [5111,5119]) || (anim = [5171,5179])
trigger1 = SelfAnimExist(5140 + (anim % 10))
value = 5140 + (anim % 10)

[State 5699, 5] ;Match over anim
type = ChangeAnim
persistent = 0
triggerall = !Name = "Simon" && !PrevStateNo = 5601
;trigger1 = Time = 0
trigger1 = MatchOver = 1
trigger1 = Anim = [5140,5149]
trigger1 = SelfAnimExist(anim+10)
value = anim+10

[State 5699, 6] ;Switch to 5110 if liedead anim does not exist
type = ChangeAnim
triggerall = !Name = "Simon"
trigger1 = Time = 0
trigger1 = Anim != [5140,5159]
trigger1 = Anim != [5110,5119]
value = 5110

[State 5699, 7] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5699, 8] ;Friction
type = VelSet
trigger1 = Vel x < .05
persistent = 0
x = 0

[State 5699, 9]
type = NotHitBy
trigger1 = 1
value = SCA
time = 1

[State 5699, 10]
type = AssertSpecial
trigger1 = PrevStateNo = 5400
flag = noshadow

[State 5699, 11]
type = VelSet
trigger1 =  PrevStateNo = 5400
x = 0
y = 0

[State 5699, 12]
type = ChangeAnim
triggerall = Name = "Simon" && PrevStateNo = 5601
trigger1 = Time = 0
value = 5601
elem = 2

;---------------------------------------------------------------------------
; Stand get-hit (shaking)
[Statedef 5700]
type    = U
movetype= H
physics = N
velset = 0,0

[State 5000, 1] ;Anim for HIT_LIGHT to HIT_HARD
type = Null
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) != [3,5]
value = ifelse((GetHitVar(groundtype) = 1),5000,5010) + GetHitVar(animtype)

[State 5000, 2] ;Anim for HIT_BACK
type = Null
trigger1 = Time = 0
trigger1 = GetHitVar(animtype) = [3,5]
value = 5030

[State 5000, 3] ;Anim for HIT_UP/HIT_DIAGUP (only if it exists)
type = Null
trigger1 = Time = 0
trigger1 = (GetHitVar(animtype) = [4,5]) && (SelfAnimExist(5047 + GetHitVar(animtype)))
value = 5047 + GetHitVar(animtype) ;5051 - 4 + type

[State 5000, 4] ;Freeze anim
type = Null
trigger1 = Time > 0
value = anim

[State 5000, 5] ;State type gets set to aerial if getting hit up
type = StateTypeSet
trigger1 = Time = 0
trigger1 = GetHitVar(yvel) != 0 || GetHitVar(fall)
trigger2 = Pos Y != 0
statetype = a

[State 5000, FFB Light]
type = ForceFeedback
trigger1 = anim = 5000
trigger2 = anim = 5010
persistent = 0
time = 6
waveform = square

[State 5000, FFB Medium]
type = ForceFeedback
trigger1 = anim = 5001
trigger2 = anim = 5011
persistent = 0
time = 8
waveform = sinesquare
ampl = 110,-1,-.3

[State 5000, FFB Hard]
type = ForceFeedback
trigger1 = anim = 5012
trigger2 = anim = 5002
trigger3 = anim = 5030
persistent = 0
time = 15
waveform = sinesquare
ampl = 140

[State -2, PosSet]
type = PosSet
trigger1 = !Time
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
y = 0

[State 5000, 6]
type = ChangeState
trigger1 = HitShakeOver && StateType = S
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5001 ;Stand get-hit (knocked back)

[State 5010, 6]
type = ChangeState
trigger1 = HitShakeOver && StateType = C
trigger1 = GetHitVar(yvel) = 0 && !GetHitVar(fall)
value = 5011

[State 5000, 7]
type = ChangeState
trigger1 = HitShakeOver
value = 5730
;---------------------------------------------------------------------------
; Air get-hit (knocked away)
[Statedef 5730]
type    = A
movetype= H
physics = N
ctrl = 0

[State 5730, 1]
type = ChangeAnim
trigger1 = Anim != [5000,5999]
trigger1 = SelfAnimExist(5030)
value = 5030

[State 5730, 2]
type = VelAdd
trigger1 = 1
y = GetHitVar(yaccel)

[State 5730, 3]
type = HitVelSet
trigger1 = Time = 0
x = 1
y = 1

[State 5730, 5]
type = ChangeState
triggerall = HitFall
trigger1 = HitOver
trigger2 = Vel Y > 0    ;Hit ground
trigger2 = Pos Y >= Const(movement.air.gethit.groundlevel)
value = 5750 ;HITA_FALL

[State 5730, 6]
type = ChangeState
trigger1 = AnimTime = 0
value = 5735 ;Air get-hit (transition)

;---------------------------------------------------------------------------
; HITA_UP_T (transition)
[Statedef 5735]
type    = A
movetype= H
physics = N

[State 5735, 1]
type = ChangeAnim
trigger1 = Time = 0
trigger1 = SelfAnimExist(5035)
trigger1 = Anim != [5051,5059] ;Not if in hit up anim
trigger1 = Anim != 5090 ;Not if hit off ground anim
trigger1 = Anim != 5420 && Anim != 5470
value = 5035

[State 5735, 2]
type = VelAdd
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5735, 4]
type = ChangeState
trigger1 = HitOver  ;Hit is over
trigger2 = AnimTime = 0 ;Anim is over
trigger3 = Vel Y > 0    ;Hit ground
trigger3 = Pos Y >= 10  ;.
trigger4 = Time = 0     ;No transition anim
trigger4 = Anim != 5035 ;.
value = 5750 ;HITA_FALL

;---------------------------------------------------------------------------
; HITA_FALL (knocked up, falling)
[Statedef 5750]
type    = A
movetype= H
physics = N

[State 5750, 1] ;Change anim when done with transition
type = ChangeAnim
trigger1 = AnimTime = 0
trigger1 = Anim = 5035
trigger2 = Time = 0     ;If no transition anim
trigger2 = Anim != 5035
trigger2 = (Anim != [5051, 5059]) && (Anim != [5061, 5069])
trigger2 = Anim != 5090 ;Not if hit off ground anim
trigger2 = Anim != 5420 && Anim != 5470
value = 5050

[State 5750, 2] ;Coming down anim
type = ChangeAnim
trigger1 = anim = [5050,5059]
trigger1 = Vel Y >= ifelse(anim = 5050, 1, -2)
trigger1 = SelfAnimExist(anim+10)
value = anim+10
persistent = 0

[State 5750, 3] ;Gravity
type = VelAdd
trigger1 = Time > 0
y = GetHitVar(yaccel)

[State 5750, 4] ;Recover near ground
type = Null
triggerall = Vel Y > 0
triggerall = Pos Y >= -20
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5200 ;HITFALL_RECOVER

[State 5750, 5]; Recover in mid air
type = Null
triggerall = Vel Y > -1
triggerall = alive
triggerall = CanRecover
trigger1 = Command = "recovery"
value = 5210 ;HITFALL_AIRRECOVER

[State 5750, 6]
type = ChangeState
trigger1 = Vel Y > 0
trigger1 = Pos Y >= ifelse((anim = [5051,5059]) || (anim = [5061,5069]) || (anim = [5400,5499]), 0, 25)
value = 5760 ;HIT_BOUNCE
;---------------------------------------------------------------------------
; HIT_BOUNCE (hit ground)
[Statedef 5760]
type    = L
movetype= H
physics = N

[State 5760 1]
type = VelSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
trigger1 = vel x > 1
x = 1

[State 5760, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5760, Var] ;Save fall velocity
type = VarSet
trigger1 = Time = 0
sysvar(1) = floor(vel y)

[State 5760, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = (anim != [5051,5059]) && (anim != [5061,5069])
trigger2 = !SelfAnimExist(5100 + (anim % 10))
value = 5100

[State 5760, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
trigger1 = time = 0
trigger1 = (anim = [5051,5059]) || (anim = [5061,5069])
trigger1 = SelfAnimExist(5100 + (anim % 10))
value = 5100 + (anim % 10)

[State 5760, 4]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5760, 5]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5760, 6] ;Reduce speed
type = VelMul
trigger1 = Time = 0
x = 0.75

[State 5760, 7]
type = ChangeState
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) = 0
value = 5810 ;HIT_LIEDOWN

[State 5760, 8]
type = GameMakeAnim
trigger1 = Time = 1
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5760, 9]
type = HitFallDamage
trigger1 = Time = 3

[State 5760, 10]
type = PlaySnd
trigger1 = Time = 1
value = F8, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5760, 11]
type = PosFreeze
trigger1 = 1

[State 5760, 12]
type = ChangeState
trigger1 = AnimTime = 0
value = 5761

[State 5760, 13]
type = ForceFeedback
trigger1 = Time = 0
waveform = sinesquare
ampl = 128,-3,-.2,.005
time = 20
;---------------------------------------------------------------------------
; HIT_BOUNCE (bounce into air)
[Statedef 5761]
type    = L
movetype= H
physics = N

[State 5101, 1] ;Coming hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim != [5101,5109]
trigger2 = !SelfAnimExist(5160 + (anim % 10))
value = 5160

[State 5101, 2] ;Coming hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
trigger1 = anim = [5101,5109]
trigger1 = SelfAnimExist(5160 + (anim % 10))
value = 5160 + (anim % 10)

[State 5101, 3]
type = HitFallVel
trigger1 = Time = 0

[State 5101, 4]
type = PosSet
trigger1 = Time = 0
y = 20

[State 5101, 5] ;Acceleration
type = VelAdd
trigger1 = 1
y = .4

[State 5101, 6] ;Hit ground
trigger1 = Vel Y > 0
trigger1 = Pos Y >= 12
type = ChangeState
value = 5810

;---------------------------------------------------------------------------
; HIT_LIEDOWN
[Statedef 5810]
type    = L
movetype= H
physics = N

[State 5810, EnvShake]
type = FallEnvShake
trigger1 = Time = 0

[State 5810, 1] ;For hit up/up-diag type (from state 5081)
type = ChangeAnim
persistent = 0
trigger1 = SelfAnimExist(5110 + (anim % 10))
trigger1 = anim = [5081,5089]
value = 5110 + (anim % 10)

[State 5810, 2] ;Hit ground anim (normal)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim != [5161,5169]
trigger2 = !SelfAnimExist(5170 + (anim % 10))
value = 5170

[State 5810, 3] ;Hit ground anim (for hit up)
type = ChangeAnim
triggerall = time = 0
triggerall = anim != [5110,5119] ;Not already changed anim
trigger1 = anim = [5161,5169]
trigger1 = SelfAnimExist(5170 + (anim % 10))
value = 5170 + (anim % 10)

[State 5810, 4]
type = HitFallDamage
trigger1 = Time = 0

[State 5810, 5]
type = PosSet
trigger1 = Time = 0
y = 0

[State 5110, 6]
type = PlaySnd
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = F8, (sysvar(1) > 5) + (sysvar(1) > 14)

[State 5810, Var] ;Get fall velocity
type = VarSet
trigger1 = Time = 0
trigger1 = GetHitVar(fall.yvel) != 0
sysvar(1) = floor(vel y)

[State 5810, 7]
type = GameMakeAnim
trigger1 = Time = 0
trigger1 = !SysVar(0)
value = 60 + (sysvar(1) > 5) + (sysvar(1) > 14)
pos = 0, 0
under = sysvar(1) <= 14

[State 5810, 8]
type = VelSet
trigger1 = Time = 0
y = 0

[State 5810, 9] ;For hit up type
type = ChangeAnim
persistent = 0
triggerall = anim = [5171,5179]
triggerall = SelfAnimExist(5110 + (anim % 10))
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground anim
value = 5110 + (anim % 10)

[State 5810, 10] ;For normal
type = ChangeAnim
persistent = 0
triggerall = Anim != [5111,5119]
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
value = 5110

[State 5810, 11] ;If just died
type = ChangeState
triggerall = !alive
trigger1 = AnimTime = 0
trigger2 = SysVar(0) ;SysVar(0) = 1 avoids hit ground frame
trigger3 = Anim = [5110,5119]
value = 5150

[State 5810, 12]
type = VarSet
trigger1 = SysVar(0)
trigger1 = Time = 0
sysvar(0) = 0

[State 5810, 13] ;Friction
type = VelMul
trigger1 = 1
x = 0.85

[State 5810, 14]
type = ForceFeedback
trigger1 = alive
trigger1 = Time = 0
time = 8
ampl = 240
waveform = sine

[State 5810, 15]
type = ForceFeedback
trigger1 = !alive
trigger1 = Time = 0
ampl = 200, 7, -.467
time = 30
waveform = sine

[State 5810, 16]
type = SelfState
trigger1 = Time = 25
value = 5120
;---------------------------------------------------------------------------
; Initialize (at the start of the round)
[Statedef 5900]
type = S

[State 5900, 1]
type = Helper
triggerall = AuthorName = "FAMFIGHT" && var(1) && RoundState < 2 && (!NumHelper(850))
trigger1 = ((RoundNo = 1) && TeamMode != Turns) || (!RoundsExisted && TeamMode = Turns)
name = "Helper Menu"
ID = 850
stateno = 850+(3*(TeamMode = Simul || !SelfAnimExist(7000)))
pos = 0,0
postype = back
facing = 1
keyctrl = 1
ownpal = 1
supermovetime = 9999
pausemovetime = 9999

[State 5900, 2]
type = Helper
trigger1 = ID = 56 && !Time
name = "Stage Helper"
ID = 30000
stateno = 30000
pos = 0,0
postype = back
facing = 1
keyctrl = 1
ownpal = 0
supermovetime = 9999
pausemovetime = 9999

[State 5900, 3] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0
first = 0
last = 2

[State 5900, 4] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0
first = 4
last = 5

[State 5900, 5] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0
first = 7
last = 30

[State 5900, 6] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0
first = 33
last = 39

[State 5900, 7] ;Clear all int variables
type = VarRangeSet
trigger1 = roundsexisted = 0
value = 0
first = 50							

[State 5900, 8] ;Clear all float variables
type = VarRangeSet
trigger1 = roundsexisted = 0
fvalue = 0

[State 5900, 9] ;Clear all int variables
type = VarRangeSet
trigger1 = 1
value = 0
first = 38
last = 39					

[State 0, VarSet]
type = VarSet
trigger1 = 1
var(28) = 0

[State 5900, 10]
type = VarSet
trigger1 = RoundNo > 1
var(6) = var(31)

[State 5900, 11]
type = VarRandom
trigger1 = AILevel && !Time && RoundsExisted = 0
v = 3
range = 0,2

[State 5900, 12]
type = VarSet
triggerall = (((RoundNo = 1) && TeamMode != Turns) || (!RoundsExisted && TeamMode = Turns))
trigger1 = !Time
var(32) = 181

[State 5900, 8] ;Change palette
type = RemapPal
trigger1 = 1
source = 1,1
dest = 1,palno

[State 5900, 9] ;Intro for round 1
type = ChangeState
trigger1 = roundno = 1
value = 190

[State 5900, 10] ;All other rounds
type = ChangeState
trigger1 = 1
value = 0
;---------------------------------------------------------------------------
;Super Explod
[Statedef 6002]
type    = A
movetype= I
physics = N
anim = 1
ctrl = 0
sprpriority = 99

[State 6002, 1]
type = Explod
trigger1 = Time = 0
anim = 6002
ID = 6002
pos = 0,0
postype = p1  ;p2,front,back,left,right
removetime = -2
supermove = 999
pausemove = 999
scale = 1*const(size.xscale),1*const(size.yscale)
ontop = 1

[State 6002, 2]
type = DestroySelf
trigger1 = Time = 1
;---------------------------------------------------------------------------
;Helper Summon Bar
[Statedef 8010]
type    = A
movetype= I
physics = N
anim = 1
ctrl = 0
sprpriority = -9

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 1
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8010) && (RoundState = 2 || RoundState = 3)
anim = F8010
ID = 8010
pos = 106,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -2
pausemovetime = -1
scale = .5,.5
sprpriority = -997
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 1 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8011) && (RoundState = 2 || RoundState = 3)
anim = F8011
ID = 8011
pos = 106,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -998
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 1 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8015) && (RoundState = 2 || RoundState = 3) && root,Var(7) < 50
anim = F8015
ID = 8015
pos = 106,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -996
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 1 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8016) && (RoundState = 2 || RoundState = 3) && root,Var (7) >= 50 && root,Var(7) < 100
anim = F8016
ID = 8016
pos = 106,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -996
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 1 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8017) && (RoundState = 2 || RoundState = 3) && root,Var (7) >= 100 && root,Var(7) < 150
anim = F8017
ID = 8017
pos = 106,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -996
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 1 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8018) && (RoundState = 2 || RoundState = 3) && root,Var (7) >= 150
anim = F8018
ID = 8018
pos = 106,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -996
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Helper Health Bar]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 1
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8000) && (RoundState = 2 || RoundState = 3)
anim = F8000
ID = 8000
pos = 63,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -997
ownpal = 1
removeongethit = 0

[State 8010, Helper Health]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 1 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8001) && (RoundState = 2 || RoundState = 3)
anim = F8001
ID = 8001
pos = 63,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -998
ownpal = 1
removeongethit = 0

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 2 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8010)
anim = F8010
ID = 8010
pos = -106,41
postype = right
facing = -1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = -1
scale = .5,.5
sprpriority = -997
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 2 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8011)
anim = F8011
ID = 8011
pos = -106,41
postype = right
facing = -1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = -1
scale = .5,.5
sprpriority = -998
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 2 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8015) && (RoundState = 2 || RoundState = 3) && root,Var(7) < 50
anim = F8015
ID = 8015
pos = 268,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = -1
scale = .5,.5
sprpriority = -996
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 2 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8016) && (RoundState = 2 || RoundState = 3) && root,Var (7) >= 50 && root,Var(7) < 100
anim = F8016
ID = 8016
pos = 268,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -996
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 2 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8017) && (RoundState = 2 || RoundState = 3) && root,Var (7) >= 100 && root,Var(7) < 150
anim = F8017
ID = 8017
pos = 268,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -996
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Explod]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 2 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8018) && (RoundState = 2 || RoundState = 3) && root,Var (7) >= 150
anim = F8018
ID = 8018
pos = 268,41
postype = left
facing = 1
vfacing = 1
bindtime = -1
vel = 0,0
accel = 0,0
random = 0,0
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -996
ontop = 0
shadow = 0,0,0
ownpal = 0
removeongethit = 0
ignorehitpause = 1

[State 8010, Helper Health Bar]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 2 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8000)
anim = F8000
ID = 8000
pos = -63,41
postype = right
facing = -1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -997
ownpal = 1
removeongethit = 0

[State 8010, Helper Health]
type = Explod
triggerall = TeamMode != Simul && TeamSide = 2 && parent,Var(6) > 0
triggerall = parent,Var(30) = 0 && Cond(NumEnemy,enemy,Var(30) = 0,0)
trigger1 = !NumExplod(8001)
anim = F8001
ID = 8001
pos = -63,41
postype = right
facing = -1
vfacing = 1
bindtime = -1
removetime = -1
pausemovetime = -1
scale = .5,.5
sprpriority = -998
ownpal = 1
removeongethit = 0

[State 8010, ModifyExplod]
type = ModifyExplod
triggerall = TeamMode != Simul
trigger1 = 1
ID = 8011
scale = (((parent,var(7)) % 50)/50.0)*.5,.5

[State 8010, ModifyExplod]
type = ModifyExplod
triggerall = parent,Var(31) != 0
triggerall = TeamMode != Simul
trigger1 = 1
ID = 8001
scale = (((parent,var(6)*1.00)/(parent,var(31)*1.00)))*.5,.5

[State 8010, PosFreeze]
type = PosFreeze
triggerall = TeamMode != Simul
trigger1 = 1
value = 1

[State 8010, RemoveExplod]
type = RemoveExplod
triggerall = TeamMode != Simul
trigger1 = parent,Var(6) <= 0
trigger2 = parent,Var(8) || Cond(NumEnemy,enemy,Var(8),0)
;trigger3 = NumHelper(6002) || Cond(NumEnemy,enemy,NumHelper(6002),0)
trigger3 = parent,Var(30) || Cond(NumEnemy,enemy,Var(30),0)
id = 8001

[State 8010, RemoveExplod]
type = RemoveExplod
triggerall = TeamMode != Simul
trigger1 = parent,Var(6) <= 0
trigger2 = parent,Var(8) || Cond(NumEnemy,enemy,Var(8),0)
;trigger3 = NumHelper(6002) || Cond(NumEnemy,enemy,NumHelper(6002),0)
trigger3 = parent,Var(30) || Cond(NumEnemy,enemy,Var(30),0)
id = 8011

[State 8010, RemoveExplod]
type = RemoveExplod
triggerall = TeamMode != Simul
trigger1 = parent,Var(8) || Cond(NumEnemy,enemy,Var(8),0)
;trigger2 = NumHelper(6002) || Cond(NumEnemy,enemy,NumHelper(6002),0)
trigger2 = parent,Var(30) || Cond(NumEnemy,enemy,Var(30),0)
id = 8000

[State 8010, RemoveExplod]
type = RemoveExplod
triggerall = TeamMode != Simul
trigger1 = parent,Var(8) || Cond(NumEnemy,enemy,Var(8),0)
;trigger2 = NumHelper(6002) || Cond(NumEnemy,enemy,NumHelper(6002),0)
trigger2 = parent,Var(30) || Cond(NumEnemy,enemy,Var(30),0)
id = 8010

[State 8010, RemoveExplod]
type = RemoveExplod
triggerall = TeamMode != Simul && NumExplod(8015)
trigger1 = parent,Var(8) || Cond(NumEnemy,enemy,Var(8),0)
trigger2 = parent,Var(30) || Cond(NumEnemy,enemy,Var(30),0)
trigger3 = root,Var(7) >= 50
id = 8015

[State 8010, RemoveExplod]
type = RemoveExplod
triggerall = TeamMode != Simul && NumExplod(8016)
trigger1 = parent,Var(8) || Cond(NumEnemy,enemy,Var(8),0)
trigger2 = parent,Var(30) || Cond(NumEnemy,enemy,Var(30),0)
trigger3 = root,Var(7) >= 100 || root,Var(7) < 50
id = 8016

[State 8010, RemoveExplod]
type = RemoveExplod
triggerall = TeamMode != Simul && NumExplod(8017)
trigger1 = parent,Var(8) || Cond(NumEnemy,enemy,Var(8),0)
trigger2 = parent,Var(30) || Cond(NumEnemy,enemy,Var(30),0)
trigger3 = root,Var(7) >= 150 || root,Var(7) < 100
id = 8017

[State 8010, RemoveExplod]
type = RemoveExplod
triggerall = TeamMode != Simul && NumExplod(8018)
trigger1 = parent,Var(8) || Cond(NumEnemy,enemy,Var(8),0)
trigger2 = parent,Var(30) || Cond(NumEnemy,enemy,Var(30),0)
trigger3 = root,Var(7) < 150
id = 8018
;---------------------------------------------------------------------------
;Super Finish
[Statedef 8300]
type    = A
movetype= I
physics = N
anim = 1
ctrl = 0
sprpriority = -9

[State 8300, 1]
type = EnvColor
trigger1 = !Time
value = 255,255,255
time = 1

[State 8300, 2]
type = Explod
trigger1 = Time = 1
anim = F3000
ID = 8300
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = 89
pausemovetime = -1
scale = 2,2
sprpriority = -5
ontop = 0
ownpal = 1
removeongethit = 0

[State 8300, 2]
type = Explod
trigger1 = Time = 1
anim = 8000+(parent,Var(28))
ID = 8300
pos = 160,120
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = -1
scale = 1,1
sprpriority = -3
ontop = 0
ownpal = 1
removeongethit = 0

[State 8300, 2]
type = Null
trigger1 = Time = 60
anim = F8300
ID = 8300
pos = 0,0
postype = left
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
pausemovetime = -1
scale = 2,2
sprpriority = -4
ontop = 0
ownpal = 1
removeongethit = 0

[State 0, AssertSpecial]
type = AssertSpecial
trigger1 = Time < 80
flag = NoBarDisplay

[State 0, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = !Time
value = F8300,0

[State 0, Pause]
type = Null
trigger1 = !Time
time = 50

;---------------------------------------------------------------------------
; Stage Helper
[Statedef 30000]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

[State 30000, Kid Niki]
type = ChangeState
trigger1 = StageVar(info.name) = "Kid Niki: Stone Wizard's Temple"
value = 30100+(10*(RoundNo > 1))

[State 30000, Kid Niki]
type = ChangeState
trigger1 = StageVar(info.name) = "Pro Wrestling: Wrestling Ring"
value = 30200

[State 30000, DestroySelf]
type = DestroySelf
trigger1 = Time = 1
;---------------------------------------------------------------------------
; Stage Helper
[Statedef 30100]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

[State 0, ScreenBound]
type = ScreenBound
trigger1 = 1
value = 0

[State 30110, 6]
type = Explod
trigger1 = !Time
anim = F30100
ID = 30100
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -999
ownpal = 0
shadow = -1
removeongethit = 0

[State 0, PosSet]
type = PosSet
trigger1 = !Time
x = 0
y = -240

[State 0, VelSet]
type = VelSet
trigger1 = 1
y = 1.6

[State 0, ChangeState]
type = ChangeState
trigger1 = Time = 120
value = 30101

[State 0, ChangeState]
type = ChangeState
trigger1 = RoundState = 2
value = 30110
;---------------------------------------------------------------------------
; Stage Helper
[Statedef 30101]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

[State 30101, 1]
type = ScreenBound
trigger1 = 1
value = 0

[State 30101, 2]
type = RemoveExplod
trigger1 = !Time
id =  30100

[State 30101, 32]
type = PosSet
trigger1 = !Time
y = 0

[State 30101, 4]
type = Explod
trigger1 = !Time
anim = F30101
ID = 30101
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -999
ownpal = 0
shadow = -1
removeongethit = 0

[State 0, PlaySnd]
type = PlaySnd
trigger1 = !Time
value = F30101,0

[State 0, ChangeState]
type = ChangeState
trigger1 = RoundState = 2
trigger2 = Time = 32
value = 30110
;---------------------------------------------------------------------------
; Stage Helper (Stone Wizard)
[Statedef 30110]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

;Variables
[State 30110, 1]
type = VarAdd
trigger1 = Var(0) < 360
var(0) = 1

[State 30110, 2]
type = VarSet
trigger1 = Var(0) >= 360
var(0) = 0

[State 30110, 3]
type = Null ;VarSet
trigger1 = 1 || fvar(0) := Cond((root,StateNo != [4911,4912]) && (root,Alive || !(root,NumPartner)),(root,Pos X),(playerID(57),Pos X))
trigger1 = 1 || fvar(1) := Cond(PlayerIDExist(58),Cond((playerID(58),StateNo != [4911,4912]) && (playerID(58),Alive),(playerID(58),Pos X),(playerID(59),Pos X)),(playerID(57),Pos X))
trigger1 = 1 || fvar(2) := Cond((root,StateNo != [4911,4912]) && (root,Alive || !(root,NumPartner)),(root,Pos Y),(playerID(57),Pos Y))
trigger1 = 1 || fvar(3) := Cond(PlayerIDExist(58),Cond((playerID(58),StateNo != [4911,4912]) && (playerID(58),Alive),(playerID(58),Pos Y),(playerID(59),Pos Y)),(playerID(57),Pos Y))

;Pos
[State 30110, 4]
type = PosSet
trigger1 = !Time
x = 0
y = 0

;Animations
[State 30110, 5]
type = RemoveExplod
trigger1 = NumExplod(30100) && !Time
id = 30100

[State 30110, 5]
type = RemoveExplod
trigger1 = NumExplod(30101) && !Time
id = 30101

[State 30110, 5]
type = RemoveExplod
trigger1 = NumExplod(30111) && !Time
id = 30111

[State 30110, 6]
type = Explod
trigger1 = !NumExplod(30110) && !Time
anim = F30110
ID = 30110
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -999
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 7]
type = RemoveExplod
trigger1 = NumExplod(30120) && (((((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) > 60) || ((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) < -60)) || (fvar(2) <= -60 || fvar(3) <= -60))
id = 30120

[State 30110, 8]
type = Explod
trigger1 = !NumExplod(30120) && ((((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) = [-60,60]) && (fvar(2) > -60 && fvar(3) > -60)) && (RoundState = 2 || RoundState = 3)
anim = F30120
ID = 30120
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 9]
type = RemoveExplod
trigger1 = NumExplod(30121) && (((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) >= -60) || (fvar(2) <= -60 || fvar(3) <= -60))
id = 30121

[State 30110, 10]
type = Explod
trigger1 = !NumExplod(30121) && ((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) < -60 && (fvar(2) > -60 && fvar(3) > -60) && (RoundState = 2 || RoundState = 3)
anim = F30121
ID = 30121
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 11]
type = RemoveExplod
trigger1 = NumExplod(30122) && (((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) <= 60) || (fvar(2) <= -60 || fvar(3) <= -60))
id = 30122

[State 30110, 12]
type = Explod
trigger1 = !NumExplod(30122) && ((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) > 60 && (fvar(2) > -60 && fvar(3) > -60) && (RoundState = 2 || RoundState = 3)
anim = F30122
ID = 30122
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 13]
type = RemoveExplod
trigger1 = NumExplod(30123) && (((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) >= -60) || (fvar(2) > -60 && fvar(3) > -60))
id = 30123

[State 30110, 14]
type = Explod
trigger1 = !NumExplod(30123) && ((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) < -60 && (fvar(2) <= -60 || fvar(3) <= -60) && (RoundState = 2 || RoundState = 3)
anim = F30123
ID = 30123
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 15]
type = RemoveExplod
trigger1 = NumExplod(30124) && (((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) <= 60) || (fvar(2) > -60 && fvar(3) > -60))
id = 30124

[State 30110, 16]
type = Explod
trigger1 = !NumExplod(30124) && ((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) > 60 && (fvar(2) <= -60 || fvar(3) <= -60) && (RoundState = 2 || RoundState = 3)
anim = F30124
ID = 30124
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 17]
type = Explod
trigger1 = !NumExplod(30125) && Var(0) = 359
anim = F30125
ID = 30125
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -997
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 18]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 30110, 19]
type = ChangeState
trigger1 = BackEdgeDist < 40 || FrontEdgeDist < 40
value = 30111

[State 30110, 19]
type = ChangeState
trigger1 = RoundState = 4
value = 30130
;---------------------------------------------------------------------------
; Stage Helper (Stone Wizard)
[Statedef 30111]
type = S
physics = N
anim = 1
ctrl = 0

;Variables
[State 30111, 1]
type = VarAdd
trigger1 = Var(0) < 360
var(0) = 1

[State 30111, 2]
type = VarSet
trigger1 = Var(0) >= 360
var(0) = 0

[State 30111, 3]
type = Null ;VarSet
trigger1 = 1 || fvar(0) := Cond((root,StateNo != [4911,4912]) && (root,Alive || !(root,NumPartner)),(root,Pos X),(playerID(57),Pos X))
trigger1 = 1 || fvar(1) := Cond(PlayerIDExist(58),Cond((playerID(58),StateNo != [4911,4912]) && (playerID(58),Alive),(playerID(58),Pos X),(playerID(59),Pos X)),(playerID(57),Pos X))
trigger1 = 1 || fvar(2) := Cond((root,StateNo != [4911,4912]) && (root,Alive || !(root,NumPartner)),(root,Pos Y),(playerID(57),Pos Y))
trigger1 = 1 || fvar(3) := Cond(PlayerIDExist(58),Cond((playerID(58),StateNo != [4911,4912]) && (playerID(58),Alive),(playerID(58),Pos Y),(playerID(59),Pos Y)),(playerID(57),Pos Y))

;Walk
[State 30111, 4]
type = VelSet
trigger1 = (BackEdgeDist < 40 || FrontEdgeDist < 40) && Time = 25
x = Cond(BackEdgeDist < 40, 2, -2)

[State 30111, 5]
type = RemoveExplod
trigger1 = NumExplod(30110) && Time = 25
id = 30110

;Animations
[State 30111, 6]
type = Explod
trigger1 = !NumExplod(30111) && Time = 25
anim = F30111
ID = 30111
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -999
ownpal = 0
shadow = -1
removeongethit = 0

[State 30111, 7]
type = RemoveExplod
trigger1 = NumExplod(30120) && (((((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) > 60)|| ((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) < -60)) || (fvar(2) <= -60 || fvar(3) <= -60))
id = 30120

[State 30111, 8]
type = Explod
trigger1 = !NumExplod(30120) && ((((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) = [-60,60]) && (fvar(2) > -60 && fvar(3) > -60)) && (RoundState = 2 || RoundState = 3)
anim = F30120
ID = 30120
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30111, 9]
type = RemoveExplod
trigger1 = NumExplod(30121) && (((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) >= -60) || (fvar(2) <= -60 || fvar(3) <= -60))
id = 30121

[State 30111, 10]
type = Explod
trigger1 = !NumExplod(30121) && ((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) < -60 && (fvar(2) > -60 && fvar(3) > -60) && (RoundState = 2 || RoundState = 3)
anim = F30121
ID = 30121
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30111, 11]
type = RemoveExplod
trigger1 = NumExplod(30122) && (((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) <= 60) || (fvar(2) <= -60 || fvar(3) <= -60))
id = 30122

[State 30111, 12]
type = Explod
trigger1 = !NumExplod(30122) && ((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) > 60 && (fvar(2) > -60 && fvar(3) > -60) && (RoundState = 2 || RoundState = 3)
anim = F30122
ID = 30122
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 13]
type = RemoveExplod
trigger1 = NumExplod(30123) && (((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) >= -60) || (fvar(2) > -60 && fvar(3) > -60))
id = 30123

[State 30110, 14]
type = Explod
trigger1 = !NumExplod(30123) && ((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) < -60 && (fvar(2) <= -60 || fvar(3) <= -60) && (RoundState = 2 || RoundState = 3)
anim = F30123
ID = 30123
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 15]
type = RemoveExplod
trigger1 = NumExplod(30124) && (((fvar(0) + ((abs(fvar(0) - fvar(1))/2)) - Pos X) <= 60) || (fvar(2) > -60 && fvar(3) > -60))
id = 30124

[State 30110, 16]
type = Explod
trigger1 = !NumExplod(30124) && ((fvar(0) + (abs(fvar(0) - fvar(1))/2)) - Pos X) > 60 && (fvar(2) <= -60 || fvar(3) <= -60) && (RoundState = 2 || RoundState = 3)
anim = F30124
ID = 30124
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30111, 17]
type = Explod
trigger1 = !NumExplod(30125) && Var(0) = 359
anim = F30125
ID = 30125
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -997
ownpal = 0
shadow = -1
removeongethit = 0

[State 30111, 18]
type = Explod
trigger1 = !NumExplod(30120) && Var(0) = 359
anim = F30125
ID = 30120
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -2
scale = 1,1
sprpriority = -998
ownpal = 0
shadow = -1
removeongethit = 0

[State 30111, 19]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 30111, 20]
type = PlaySnd
trigger1 = Time >= 57 && (Time % 32) = 25
value = F30111,0

[State 30111, 21]
type = ChangeState
trigger1 = Pos X >= 0 && Vel X > 0
trigger2 = Pos X <= 0 && Vel X < 0
value = 30110
;---------------------------------------------------------------------------
; Stage Helper (Stone Wizard)
[Statedef 30130]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

;Animations
[State 30110, 1]
type = RemoveExplod
trigger1 = !Time

[State 30110, 2]
type = Explod
trigger1 = !Time
anim = F30130
ID = 30130
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -999
ownpal = 0
shadow = -1
removeongethit = 0

[State 30110, 3]
type = AssertSpecial
trigger1 = 1
flag = NoAutoTurn

[State 0, PlaySnd]
type = PlaySnd
trigger1 = Time = 21
value = F30130,0
;---------------------------------------------------------------------------
; Camera Man (Initialize)
;Var(0) = Timer for turning around
;Var(1) = "Direction"
;Var(2) = Left Boundary
;Var(3) = Right Boundary
;fvar(0) = P1/P3's Front
;fvar(1) = P2/P4's Front
;fvar(2) = P1/P3's Back
;fvar(3) = P2/P4's Back
;fvar(4) = ScreenPos X (debug purposes)
[Statedef 30200]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

[State 0, PosSet]
type = PosSet
trigger1 = !Time
x = 0
y = -38

[State 30110, 2]
type = Explod
trigger1 = !Time
anim = F30200
ID = 30200
pos = 0,0
postype = P1
facing = 1
vfacing = 1
bindtime = -1
removetime = -1
scale = 1,1
sprpriority = -999
ownpal = 0
shadow = -1
removeongethit = 0

[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(0) = 112

[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(2) = 180

[State 0, VarSet]
type = VarSet
trigger1 = !Time
var(3) = 196

[State 30110, 4]
type = ChangeState
trigger1 = RoundState != 1 && root,Ctrl && enemy,Ctrl
value = 30201
;---------------------------------------------------------------------------
; Camera Man (Move)
[Statedef 30201]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

[State 30201, 1]
type = Null ;VarSet
trigger1 = 8 || fvar(0) := Cond((root,StateNo != [4911,4912]) && (root,Alive || !(root,NumPartner)),(root,ScreenPos X + (root,const(size.ground.front) * root,Facing)),(playerID(57),ScreenPos X + (playerID(57),const(size.ground.front) * playerID(57),Facing)))
trigger1 = 8 || fvar(1) := Cond(NumPartner,Cond((playerID(58),StateNo != [4911,4912]) && (playerID(58),Alive),(playerID(58),ScreenPos X + (playerID(58),const(size.ground.front) * playerID(58),Facing)),(playerID(59),ScreenPos X + (playerID(59),const(size.ground.front) * playerID(59),Facing))),0)
trigger1 = 8 || fvar(1) := Cond(NumPartner,fvar(1), playerID(57),ScreenPos X + (playerID(57),const(size.ground.front) * playerID(57),Facing))
trigger1 = 8 || fvar(2) := Cond((root,StateNo != [4911,4912]) && (root,Alive || !(root,NumPartner)),(root,ScreenPos X - (root,const(size.ground.back) * root,Facing)),(playerID(57),ScreenPos X - (playerID(57),const(size.ground.back) * playerID(57),Facing)))
trigger1 = 8 || fvar(3) := Cond(NumPartner,Cond((playerID(58),StateNo != [4911,4912]) && (playerID(58),Alive),(playerID(58),ScreenPos X - (playerID(58),const(size.ground.back) * playerID(58),Facing)),(playerID(59),ScreenPos X - (playerID(59),const(size.ground.back) * playerID(59),Facing))),0)
trigger1 = 8 || fvar(3) := Cond(NumPartner,fvar(3), playerID(57),ScreenPos X - (playerID(57),const(size.ground.back) * playerID(57),Facing))
trigger1 = 8 || fvar(4) := ScreenPos X

[State 30201, 2]
type = VarAdd
trigger1 = 1
var(0) = -1

[State 30201, 3]
type = VarSet
trigger1 = !Var(0)
var(1) = 0+(!Var(1))

[State 30201, 4]
type = VarSet
trigger1 = !Var(0)
var(0) = 112

[State 30201, 5]
type = VelSet
trigger1 = !Var(1) ;&& Pos X > root,Pos X + (root,const(size.ground.front) * Facing)
x = -2*Cond((ScreenPos X - fvar(0)) != 0,abs(ScreenPos X - fvar(0))/(ScreenPos X - fvar(0)),0)

[State 30201, 6]
type = VelSet
trigger1 = Var(1) ;&& Pos X <= root,Pos X - (root,const(size.ground.back) * Facing)
x = -2*Cond((ScreenPos X - fvar(1)) != 0,abs(ScreenPos X - fvar(1))/(ScreenPos X - fvar(1)),0)

[State 30201, 7]
type = VelSet
trigger1 = !Var(1) && ((ScreenPos X < FVar(0) && ScreenPos X >= FVar(2) && Vel X >= 0) || (ScreenPos X >= FVar(0) && ScreenPos X < FVar(2) && Vel X < 0));Pos X >= root,Pos X - (root,const(size.ground.back) * Facing) || Pos X > root,Pos X - (root,const(size.ground.back) * Facing)
trigger2 = Var(1) && ((ScreenPos X < FVar(1) && ScreenPos X >= FVar(3) && Vel X >= 0) || (ScreenPos X >= FVar(1) && ScreenPos X < FVar(3) && Vel X < 0))
trigger3 = !Var(2) && Vel X < 0 || !Var(3)  && Vel X >= 0
x = 0

[State 0, VarSet]
type = VarAdd
trigger1 = 1
var(2) = floor(Vel X)

[State 0, VarSet]
type = VarAdd
trigger1 = 1
var(3) = floor(Vel X*-1)

[State 30201, 8]
type = ChangeState
trigger1 = Time = 64
value = 30202

;---------------------------------------------------------------------------
; Camera Man (Stop)
[Statedef 30202]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

[State 30202, 1]
type = ChangeState
trigger1 = Time = 64
value = 30201

;---------------------------------------------------------------------------
; RIP Cheep-Cheeps
[Statedef 39200]
type = S
physics = N
anim = 1
ctrl = 0
velset = 0,0

;Var(0) = Pseudo Random Reg 1
;Var(1) = Pseudo Random Reg 2
;Var(2) = Pseudo Random Reg 3
;Var(3) = Carry Flag (for taking last bit before rotation)
;Var(4) = Carry Flag (for adding to a register)
;Var(5) = X Register (Placeholder)
;Var(6) = Y Register (Placeholder)
;Var(7) = Cheep Cheep Timer
;Var(8) = $00
;Var(9) = $01
;Var(10) = Summon the Cheep


;Initialize
[State 30200, 1]
type = VarSet
trigger1 = !Time
var(0) = 165

[State 0, PosSet]
type = PosSet
trigger1 = !Time
x = 0

;XORing Carry
[State 30200, 2]
type = VarSet
triggerall = Time
trigger1 = ((Var(0) & (2**1)) ^ (Var(1) & (2**1))) = 0
var(3) = 0

[State 30200, 3]
type = VarSet
triggerall = Time
trigger1 = ((Var(0) & (2**1)) ^ (Var(1) & (2**1))) = 0
var(4) = 0

;Rotate Bits
[State 30200, 4]
type = Null
triggerall = Time
trigger1 = 1 || Var(3) := (Var(0) & (2**0))
trigger1 = 1 || Var(0) := ((Var(4) * (2**8)) + Var(0))
trigger1 = 1 || Var(0) := (Var(0)/2)
trigger1 = 1 || Var(4) := Var(3)
;var(0) = Var(0) & 255

[State 30200, 5]
type = Null
triggerall = Time
trigger1 = 1 || Var(3) := (Var(1) & (2**0))
trigger1 = 1 || Var(1) := (Var(1)/2)
trigger1 = 1 || Var(1) := (Var(4) * (2**7)) + Var(1)
trigger1 = 1 || Var(4) := Var(3)
;var(1) = Var(1) & 255

[State 30200, 6]
type = Null
triggerall = Time
trigger1 = 1 || Var(3) := (Var(2) & (2**0))
trigger1 = 1 || Var(2) := (Var(2)/2)
trigger1 = 1 || Var(2) := (Var(4) * (2**7)) + Var(2)
trigger1 = 1 || Var(4) := Var(3)
;trigger1 = 1 || (Var(0) :=  (Var(0) + (2**7)))
;var(2) = Var(2) & 255

;Set Carry
[State 30200, 7]
type = VarSet
trigger1 = Time
var(3) = 1

[State 30200, 8]
type = VarSet
trigger1 = Time
var(4) = 1

;-----Cheep Cheep Initialization-----
;Set Y
[State 30200, 9]
type = VarSet
trigger1 = Time
var(6) = Var(1) & 3

;Set Timer
[State 30200, 10]
type = VarSet
trigger1 = Time && !Var(7)
var(7) = 16+(16*(Var(6) > 0))+(40*(Var(6) = 3))+(32*(Var(6) = 4))

;MaxCC
;------------------------------------
[State 30200, 11]
type = VarSet
trigger1 = Time && (NumExplod(30020) >= (Var(1) & 3))
var(10) = 1

;Set Y Again
[State 30200, 11]
type = VarSet
trigger1 = Time && Var(10)
var(6) = 3

;Store Vars
[State 30200, 12]
type = VarSet
trigger1 = Time && Var(10)
var(8) = Var(0) & 3

[State 30200, 13]
type = VarSet
trigger1 = Time && Var(10)
var(9) = Var(0) & 3

;GSeed
;------------------------------------
;use low nybble of third pseudorandom instead
[State 30200, 13]
type = VarSet
trigger1 = Time && ((Var(1) & 3) != 0) && Var(10)
var(8) = Var(2) & 15

;RSeed
;------------------------------------
;Set Y
[State 30200, 14]
type = VarSet
trigger1 = Time && Var(10)
var(6) = Var(8)

;Pick Cheep Speed (Will go back to this later)
[State 30200, 14]
type = VarSet
trigger1 = Time && Var(10)
var(9) = 0 ;Cheep speeds will go here, facing would be decided from that

[State 30200, 14]
type = VarSet
trigger1 = Time && Var(10)
var(6) = Var(7)

;Change Cheep Speed (Will go back to this later)
[State 30200, 14]
type = VarSet
trigger1 = Time && ((Var(9) & 2) != 0) && Var(10)
var(9) = var(9) ;Cheep speeds will go here, facing would be decided from that


;Cheep-Cheep positon numbers:
;128, 48, 64, 128
;48, 80, 80, 112
;32, 64, 128, 160
;112, 64, 144, 104
;D2XPos1
;------------------------------------
;Set Cheep Position (Will go back to this later)
[State 30200, 14]
type = VarSet
trigger1 = Time && ((Var(7) & 2) != 0) && Var(10)
var(10) = Pos X + 0 ;0 will be cheep position

;D2XPos2
;------------------------------------
;Set Cheep Position (Will go back to this later)
[State 30200, 14]
type = VarSet
trigger1 = Time && ((Var(8) & 2) = 0) && Var(10)
var(10) = Pos X - 0 ;0 will be cheep position

;-----Summon Cheep Cheep-----

[State 0, VarAdd]
type = VarAdd
trigger1 = Time && Var(7)
var(7) = -1

[State 0, Explod]
type = Explod
trigger1 = Time && !Var(7) && NumExplod(300200) < 3
anim = F30200
ID = 30200
pos = 160,256
postype = left  ;P2, Front, Back, Left, Right
facing = 1
vel = 0,-15
accel = 0,.44
removetime = 120
scale = 1,1
sprpriority = -999
ontop = 0
ownpal = 1

